Python 安装 xmlrpclib

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32134362/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 11:04:24  来源:igfitidea点击:

Python install xmlrpclib

pythonpython-2.7pipvirtualenv

提问by edumike

I'm in a virtualenv and trying to run a script I get the following:

我在 virtualenv 中并尝试运行脚本,我得到以下信息:

Traceback (most recent call last):
  File "blah.py", line 15, in <module>
    from xmlrpc import server
ImportError: No module named xmlrpc

Ok so that seems that I need xmlrpc, which I'm assuming means I need xmlrpclib

好的,看来我需要 xmlrpc,我假设这意味着我需要 xmlrpclib

So I try that:

所以我尝试这样做:

(env) ??? pip2.7 install xmlrpclib                                                                
Collecting xmlrpclib
  Could not find a version that satisfies the requirement xmlrpclib (from versions: )
  Some externally hosted files were ignored as access to them may be unreliable (use --allow-external xmlrpclib to allow).
No matching distribution found for xmlrpclib

Ok, so then I'll try the --allow-external to get it working:

好的,那么我会尝试 --allow-external 让它工作:

(env) ??? pip2.7 install --allow-external xmlrpclib                                                                                                                           ? ?
You must give at least one requirement to install (see "pip help install")

Not sure why xmlrpclib isn't seen to be a valid argument?

不确定为什么 xmlrpclib 不被视为有效参数?

采纳答案by edumike

The answer is that the module xmlrpcis part of python3, not python2.x

答案是该模块xmlrpc是python3的一部分,而不是python2.x

details: https://docs.python.org/3/library/xmlrpc.server.html

详情:https: //docs.python.org/3/library/xmlrpc.server.html

Should already be installed, just go ahead and use it.

应该已经安装了,继续使用它。

回答by Nishant Nawarkhede

If you are using python 2.x then xmlrpclibis part of standard lib. No need of installing it.

如果您使用的是 python 2.x,那么它xmlrpclib是标准库的一部分。不需要安装它。

Anyway you can download xmlrpclib from http://effbot.org

无论如何,您可以从http://effbot.org下载 xmlrpclib

回答by pocketfullofcheese

I believe the answer to your question can be found here.

我相信您的问题的答案可以在这里找到

Try adding --allow-unverifiedto your last command.

尝试添加--allow-unverified到您的最后一个命令。

EDIT:I think your import statement is wrong. The module is called xmlrpclib, not xmlrpc

编辑:我认为您的导入语句是错误的。模块被调用xmlrpclib,而不是xmlrpc

回答by Nhor

I'm not sure if pipprovides this lib. Just download xmlrpclibfrom here http://effbot.org/downloads/#xmlrpclib, unpack it and then run:

我不确定是否pip提供这个库。只需xmlrpclib从这里下载http://effbot.org/downloads/#xmlrpclib,解压然后运行:

python3 setup.py build
python3 setup.py install