无法导入numpy,DLL加载失败:找不到指定的模块

时间:2019-12-17 14:47:21

标签: pandas numpy cx-freeze

我构建了一个tkinter应用程序,其中使用了pandas,并且该可执行文件在我的计算机上以及带有anaconda env的计算机上都运行良好,但是每次我尝试在没有python的计算机上运行时,都会出现以下错误。

error message

setup.py


from cx_Freeze import setup, Executable
import os.path
import sys
import nltk
import numpy

nltk.download('punkt', download_dir='nltk_packages') 

PYTHON_INSTALL_DIR = os.path.dirname(os.path.dirname(os.__file__))

os.environ['TCL_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tcl8.6')
os.environ['TK_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tk8.6')


base = None

# if sys.platform == 'win32':
#     base = "Win32GUI"

executables = [Executable("main.py", base=base)]


packages = ['sqlalchemy.dialects','sqlalchemy.sql.default_comparator','numpy']
options = {
    'build_exe': {    
        'packages':packages,
        "includes": ["numpy","numpy.core._methods"],
        'include_files':['nltk_packages','stemmedStop.csv','stemmedWhite.csv',os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tk86t.dll'),
           os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tcl86t.dll') ]},


}

setup(
    name = "Carrefour Nlc",
    options = options,
    version = "0.0.1",
    description = '<any description>',
    executables = executables
)

i tried this solution with no sucess

1 个答案:

答案 0 :(得分:0)

好像您有多个NumPy版本。 重复执行-pip3卸载numpy-直到不再有numpy。 然后-pip install numpy-应该可以解决