如何在 python 3.4 中安装 xmlrpclib?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25676943/
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
How to install xmlrpclib in python 3.4?
提问by James
When I am trying to install xmlrpclib, I am getting following error in python version 3.4
当我尝试安装 xmlrpclib 时,在 python 3.4 版中出现以下错误
Downloading/unpacking xmlrpclib Could not find any downloads that satisfy the requirement xmlrpclib Some externally hosted files were ignored (use --allow-external xmlrpclib to allow). Cleaning up... No distributions at all found for xmlrpclib Storing debug log for failure in /home/shiva/.pip/pip.log
下载/解包 xmlrpclib 找不到任何满足要求的下载 xmlrpclib 一些外部托管的文件被忽略(使用 --allow-external xmlrpclib 允许)。正在清理... xmlrpclib 根本找不到任何发行版 正在 /home/shiva/.pip/pip.log 中存储失败的调试日志
How to install xmlrpclib in python 3.4 ?
如何在 python 3.4 中安装 xmlrpclib?
采纳答案by Simeon Visser
xmlrpclibis part of the standard library in Python 2.x. It's not a package that you need to install.
xmlrpclib是 Python 2.x 标准库的一部分。它不是您需要安装的软件包。
In Python 3.x you can import it from xmlrpcinstead: https://docs.python.org/3/library/xmlrpc.html. You can import the client from xmlrpc.client: https://docs.python.org/3/library/xmlrpc.client.html#module-xmlrpc.client.
在 Python 3.x 中,您可以从以下位置导入它xmlrpc:https://docs.python.org/3/library/xmlrpc.html。您可以从xmlrpc.client以下位置导入客户端:https: //docs.python.org/3/library/xmlrpc.client.html#module-xmlrpc.client。
回答by focus zheng
import xmlrpc.client as xc
将 xmlrpc.client 导入为 xc
enter code hereenter code here
client = xc.Server('http://' + host + ':' + port + '/RPC2')
client.supervisor.getState()
client.supervisor.getProcessInfo('process name')

