构建我的exe之后,当我运行它时,我收到一个错误,说它无法导入numpy.core.multiarray。
我已经测试过:
我使用的包:Easygui,Opencv2,pytesseract,os,枕头,正则表达式
我在W10上运行python 3.6.1
这是我的setup.py。
from cx_Freeze import setup, Executable
import os
os.environ['TCL_LIBRARY'] = r'C:\Users\Farinha\Anaconda3\tcl\tcl8.6'
os.environ['TK_LIBRARY'] = r'C:\Users\Farinha\Anaconda3\tcl\tk8.6'
includes = []
include_files = [r"C:\Users\Farinha\Anaconda3\DLLs\tcl86t.dll", \
r"C:\Users\Farinha\Anaconda3\DLLs\tk86t.dll"]
setup(name='InstantScale',
version = '0.1',
description='Parse stuff',
options = {"build_exe": {"includes": includes, "include_files": include_files}},
executables = [Executable("main.py")])
当我运行蝙蝠暂停控制台时的错误
ImportError: numpy.core.multiarray failed to import
Traceback (most recent call last):
File "C:\Users\Farinha\Anaconda3\lib\site-packages\cx_Freeze\initscripts\__startup__.py", line 14, in run
module.run()
File "C:\Users\Farinha\Anaconda3\lib\site-packages\cx_Freeze\initscripts\Console.py", line 26, in run
exec(code, m.__dict__)
File "main.py", line 2, in <module>
ImportError: numpy.core.multiarray failed to import
欢迎所有帮助,提前致谢
答案 0 :(得分:0)
将numpy包直接复制到您的目录中。
然后添加以下行:
import numpy.core._methods
import numpy.lib.format
答案 1 :(得分:0)
我管理修复它。
我手动将包添加到选项中。
packages = ["numpy"]
options = {"build_exe": {"includes": includes, "include_files": include_files, "packages"
答案 2 :(得分:0)
就我而言,在cxFreeze选项中使用optimize=2
时发生了错误。更多信息:https://github.com/numpy/numpy/issues/13248
setup(name='InstantScale',
version = '0.1',
description='Parse stuff',
options = {"build_exe": {"optimize": 1}},
executables = [Executable("main.py")])