问题
I have been stuck for some time. My configuration is: python 3.5
, xlwings 0.5.0
and Windows 7
. I get the following traceback while trying to import xlwings
:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Program Files\Python 3.5\lib\site-packages\xlwings\__init__.py", line 20, in <module>
from . import _xlwindows as xlplatform
File "C:\Program Files\Python 3.5\lib\site-packages\xlwings\_xlwindows.py", line 15, in <module>
import pywintypes
File "C:\Program Files\Python 3.5\lib\site-packages\win32\lib\pywintypes.py", line 124, in <module>
__import_pywin32_system_module__("pywintypes", globals())
File "C:\Program Files\Python 3.5\lib\site-packages\win32\lib\pywintypes.py", line 117, in __import_pywin32_system_module__
assert sys.modules[modname] is not old_mod
AssertionError
After some search on the internet, my understanding is that the problem comes from pywin32 'known problems', but I am not sure what it is all about. Can you help, please?
回答1:
At the moment, your only easy option to install pywin32 on Python 3.5 is to use the Anaconda distribution. The official binaries from sourceforge don't seem to work with Python 3.5. Also, there are no unofficial binaries yet.
回答2:
I finally isntalled pywin32 from here, as suggested by Felix Zumstein. After a bit of cleaning in my Python 3.5 folders (site-packages
), xlwings
finally worked.
来源:https://stackoverflow.com/questions/33769101/xlwings-with-python-3-5-on-windows