带有pandas和numpy的pyinstaller,exe在运行时引发错误

时间:2019-01-22 21:10:13

标签: python-3.x pyinstaller

我正在尝试使用小型测试程序的Pyinstaller制作EXE。 我创建了一个虚拟环境来缩小exe的大小,因为anaconda包含它拥有的每个库。

运行时错误:

__TIME__

我已经尝试使用python35及其相同的错误创建新环境 我使用pip安装了numpy,然后安装了所有其他软件包

test.py代码:

Traceback (most recent call last):
  File "test.py", line 1, in <module>
  File "c:\users\madanr\appdata\local\continuum\anaconda3\envs\pyin36\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\pandas\__init__.py", line 19, in <module>
ImportError: Missing required dependencies ['numpy']
[15592] Failed to execute script test

点冻结针对我的环境(pyin36)

import pandas as pd
import numpy as np

pdf = pd.DataFrame(np.random.randint(0,100,size=(100, 4)), columns=list('ABCD'))
print(pdf)

我要发布> pyinstaller test.py cmd输出在这里

altgraph==0.16.1
certifi==2018.11.29
future==0.17.1
macholib==1.11
numpy==1.16.0
pandas==0.23.4
pefile==2018.8.8
PyInstaller==3.4
pyodbc==4.0.25
pypiwin32==223
python-dateutil==2.7.5
pytz==2018.9
pywin32==224
pywin32-ctypes==0.2.0
scipy==1.2.0
six==1.12.0
wincertstore==0.2

1 个答案:

答案 0 :(得分:1)

PyInstaller 3.4numpy 1.16之间肯定存在问题,导致您看到错误。在问题解决之前,将numpy还原为1.15.4应该对您有用:

pip install numpy==1.15.4

然后用.exe重建PyInstaller,然后重试。