【发布时间】:2018-04-29 07:26:55
【问题描述】:
我正在尝试使用 Windows 的 PyInstaller(开发版)将 Python 脚本包装到 exe 中。
脚本使用 Pandas,我在运行 exe 时遇到了错误。
Traceback (most recent call last): File "site-packages\pandas\__init__.py", line 26, in <module> File "C:\Users\Eddie\Anaconda3\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
exec(bytecode, module.__dict__) File "site-packages\pandas\_libs\__init__.py", line 4, in <module> File "C:\Users\Eddie\Anaconda3\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 714, in load_module
module = loader.load_module(fullname) File "pandas/_libs/tslib.pyx", line 1, in init pandas._libs.tslib ModuleNotFoundError: No module named 'pandas._libs.tslibs.timedeltas'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "G5k Version file Extract (with tkinter).py", line 15, in <module> File "C:\Users\Eddie\Anaconda3\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
exec(bytecode, module.__dict__) File "site-packages\pandas\__init__.py", line 35, in <module> ImportError: C extension: No module named 'pandas._libs.tslibs.timedeltas' not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace --force' to build the C extensions first.
我已经尝试为没有 pandas 的程序执行此操作,一切都很好。
这与已经为 Python 2 解决的 another question 非常相似,但我使用的是 Python 3,由于 .spec 文件格式已更改,该解决方案的应用方式不同。
Python 3.6
PyInstaller - 版本 3.3
熊猫 - 版本 0.20.3
【问题讨论】:
标签: python windows python-3.x pandas pyinstaller