我试图将pyinstaller与pandas一起使用。我写了一个非常简单的模块:
installtest.py:
import pandas
print 'Hello!'
然后做了:
pyinstaller .\installtest.py
接下来,我按照this other question中的说明编辑了installtest.spec,删除了build和dist目录,并在编辑的规范上再次运行了pyinstaller:
pyinstaller .\installtest.spec
然后我尝试像这样运行生成的exe:
.\dist\installtest\installtest.exe
但是,我收到以下错误:
Traceback (most recent call last):
File "installtest.py", line 1, in <module>
import pandas
File "c:\users\admini~1\appdata\local\temp\pip-build-kuazog\pyinstaller\PyInstaller\loader\pyimod03_importers.py", lin
e 389, in load_module
File "site-packages\pandas\__init__.py", line 13, in <module>
ImportError: C extension: hashtable not built. If you want to import pandas from the source directory, you may need to r
un 'python setup.py build_ext --inplace' to build the C extensions first.
Failed to execute script installtest
它显然是在site-packages \ pandas__init __。py而不是dist文件夹中的任何内容。也许这是问题的一部分?我检查了dist文件夹,它有以下pandas相关文件:
pandas._sparse.pyd
pandas._testing.pyd
pandas.algos.pyd
pandas.hashtable.pyd
pandas.index.pyd
pandas.json.pyd
pandas.lib.pyd
pandas.msgpack._packer.pyd
pandas.msgpack._unpacker.pyd
pandas.parser.pyd
pandas.tslib.pyd
以下是一些系统信息:
Python 2.7.11 :: Continuum Analytics,Inc。
pandas版本0.17.0
pyinstaller版本3.2
使用Windows Server 2012 R2和Powershell
我的问题:我怎样才能让这个例子有效?