Python安装xmlrpclib

我在virtualenv并尝试运行脚本我得到以下内容:

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

好吧,好像我需要xmlrpc,我假设我需要xmlrpclib

所以我试试:

(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

好的,那么我会尝试使用–allow-external来使它工作:

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

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

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

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

应该已经安装,只需继续使用它.

点赞