我最近在Windows 7上将我的python安装从python xy更改为anaconda 64位。我尝试启动我构建的应用程序,它使用msgpack-python和msgpack-numpy,但突然间msgpack- numpy在导入时会抛出错误。
In [2]: import msgpack_numpy
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-2-4f549c7ad545> in <module>()
----> 1 import msgpack_numpy
C:\Anaconda\lib\site-packages\msgpack_numpy.py in <module>()
7 import numpy as np
8 import msgpack
----> 9 import msgpack._packer as _packer
10 import msgpack._unpacker as _unpacker
11
ImportError: No module named _packer
我已经检查过,我的msgpack(0.4.2)版本没有名为_packer或_unpacker的属性。奇怪的是,在我拥有的另一台仍然运行python xy的计算机上,msgpack模块(也是版本0.4.2)确实具有这些属性!
我有什么线索可以解决这个问题?这是一个64位的问题吗?
答案 0 :(得分:0)
原来msgpack库是在没有cython的情况下构建的。运行pip install时出现以下错误:
collect2.exe: error: ld returned 1 exit status
WARNING: Failed to compile extensiom modules.
msgpack uses fallback pure python implementation.
command 'C:\\MinGW\\bin\\g++.exe' failed with exit status 1
cythonize: 'msgpack/_packer.pyx'
cythonize: 'msgpack/_unpacker.pyx'
warning: no files found matching '*.c' under directory 'msgpack'
Successfully installed msgpack-python
Cleaning up...
我会调查一下。显然_packer和_unpacker是&#39;扩展模块&#39;那些没有正确构建的我现在有一个没有它们的纯python版本。