error message Missing required dependencies, import error: Missing required dependencies ['numpy' ] when I try and freeze an executable
error message Missing required dependencies, import error: Missing required dependencies ['numpy' ] when I try and freeze an executable
我正在尝试使用 python 3.6 制作一个可执行程序,我发现唯一可以执行此操作的软件是 cx_Freeze。但是,每次我在 CMD 中 运行 "python setup.py build" 时都会遇到问题,我在尝试打开我的应用程序时遇到错误。
缺少必需的依赖项,导入错误:当我尝试冻结可执行文件时缺少必需的依赖项['numpy']。
这是我的setup.py
import cx_Freeze
from cx_Freeze import setup
from cx_Freeze import Executable
import sys
import matplotlib
import pandas
import os
import os.path
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 = [cx_Freeze.Executable("EXE.py",icon = 'RomacLogo.ico', base=base)]
build_exe_options = {"packages": ["numpy"]}
cx_Freeze.setup(
name = "DAGM",
options = {"build.exe":{"packages":["tkinter", "matplotlib",'numpy', "numpy.lib.format", "pandas", "glob"], "include_files":["RomacLogo.ico"]}},
version = "0.01",
description = "Data Transfer and Analysis Application",
executables = executables
)
除了cx_freeze之外,还有其他冻结程序可以用来制作可执行文件吗??
如有任何帮助,我们将不胜感激!
RESOLVED-KINDA...我在 python 3.5.0 中创建了一个虚拟环境,并且能够 运行 py-installer for python 3.5。无法 cx_Freeze 工作 numpy 依赖项仍然是一个问题。
这是我的 setup.py,我可以确认它对 CX_freeze 适用于带有 tkinter、pandas 和 numpy 的应用程序。 Numpy 似乎是一个很难破解的。
import sys
from cx_Freeze import setup, Executable
import os
build_exe_options = {"include_files": ["tcl86t.dll", "tk86t.dll"], "packages": ["numpy"]}
base = None
if sys.platform == "win32":
base = "Win32GUI"
os.environ['TCL_LIBRARY'] = r'C:\Users\lyu\AppData\Local\Programs\Python\Python36\tcl\tcl8.6'
os.environ['TK_LIBRARY'] = r'C:\Users\lyu\AppData\Local\Programs\Python\Python36\tcl\tk8.6'
setup(
name = "Fun Fun Fun",
version = "1.0",
description = "Fun Fun Fun",
options = {"build_exe": build_exe_options},
executables = [Executable("funfunfunfunfun.py", base = base)],
package_dir={'': ''},
)
在Lib/site-packages/numpy/core/中找到名为_methods
的numpy子模块复制粘贴到build/exe.win64- 3.6/numpy/core/.
我正在尝试使用 python 3.6 制作一个可执行程序,我发现唯一可以执行此操作的软件是 cx_Freeze。但是,每次我在 CMD 中 运行 "python setup.py build" 时都会遇到问题,我在尝试打开我的应用程序时遇到错误。
缺少必需的依赖项,导入错误:当我尝试冻结可执行文件时缺少必需的依赖项['numpy']。
这是我的setup.py
import cx_Freeze
from cx_Freeze import setup
from cx_Freeze import Executable
import sys
import matplotlib
import pandas
import os
import os.path
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 = [cx_Freeze.Executable("EXE.py",icon = 'RomacLogo.ico', base=base)]
build_exe_options = {"packages": ["numpy"]}
cx_Freeze.setup(
name = "DAGM",
options = {"build.exe":{"packages":["tkinter", "matplotlib",'numpy', "numpy.lib.format", "pandas", "glob"], "include_files":["RomacLogo.ico"]}},
version = "0.01",
description = "Data Transfer and Analysis Application",
executables = executables
)
除了cx_freeze之外,还有其他冻结程序可以用来制作可执行文件吗??
如有任何帮助,我们将不胜感激!
RESOLVED-KINDA...我在 python 3.5.0 中创建了一个虚拟环境,并且能够 运行 py-installer for python 3.5。无法 cx_Freeze 工作 numpy 依赖项仍然是一个问题。
这是我的 setup.py,我可以确认它对 CX_freeze 适用于带有 tkinter、pandas 和 numpy 的应用程序。 Numpy 似乎是一个很难破解的。
import sys
from cx_Freeze import setup, Executable
import os
build_exe_options = {"include_files": ["tcl86t.dll", "tk86t.dll"], "packages": ["numpy"]}
base = None
if sys.platform == "win32":
base = "Win32GUI"
os.environ['TCL_LIBRARY'] = r'C:\Users\lyu\AppData\Local\Programs\Python\Python36\tcl\tcl8.6'
os.environ['TK_LIBRARY'] = r'C:\Users\lyu\AppData\Local\Programs\Python\Python36\tcl\tk8.6'
setup(
name = "Fun Fun Fun",
version = "1.0",
description = "Fun Fun Fun",
options = {"build_exe": build_exe_options},
executables = [Executable("funfunfunfunfun.py", base = base)],
package_dir={'': ''},
)
在Lib/site-packages/numpy/core/中找到名为_methods
的numpy子模块复制粘贴到build/exe.win64- 3.6/numpy/core/.