问题
I have been using Linux to programm Python scripts, but now I have to make one of them work on Windows XP, and here I am a beginner. I have installed Python 3.4 in C:\Python34, and I have my Python script in E:\solidworks_xmlrpc. This script works perfectly on Linux, but on Windows I get this error message:
import xmlrpclib
ImportError: No module named "xmlrpclib"
I checked if there was an xmlrpc folder in C:\Python34\Lib and there is. I also defined PYTHONPATH and PYTHONHOME in system variables.
Anyone knows how to solve this, please?
Thank you so much.
EDIT
I deleted the content of the programm only a moment to proof:
import sys
print(sys.path)
And the cmd returned this:
['E:\\solidworks_xmlrpc', 'C:\\WINDOWS\\system32\\python34.zip', 'C:\\Python34\\
DLLs', 'C:\\Python34\\lib', 'C:\\Python34', 'C:\\Python34\\lib\\site-packages']
回答1:
This is the real answer to the question:
Python 3.4 brings the library xmlrpc, which replaces old xmlrpclib.
So, if you have installed Python 3.4 on Windows and you want to use xmlrpclib (probably as a client side), don't write anymore this:
import xmlrpclib
Replace that with this line:
from xmlrpc import client
And replace every match of xmlrpc in the rest of your code with client.
来源:https://stackoverflow.com/questions/22528530/run-python-script-importing-xmlrpclib-on-windows