I cx_freeze
da Pythonプログラム(cx_freeze 4.3.4から5.0に移動)を見て、Pythonの/ libsを探し続けています。 )ディレクトリに移動します。私はmultiprocessing
を使用しているようcx_freezeは、コンパイルされたライブラリではなく、
私は取得しています現在のエラーは、以下の通りである:
Traceback (most recent call last):
File "D:\Anaconda3\lib\site-packages\cx_Freeze\initscripts\__startup__.py", line 12, in <module>
__import__(name + "__init__")
File "D:\Anaconda3\lib\site-packages\cx_Freeze\initscripts\Console.py", line 21, in <module>
scriptModule = __import__(moduleName)
File "Main.py", line 4, in <module>
File "D:\Anaconda3\lib\multiprocessing\__init__.py", line 16, in <module>
from . import context
File "D:\Anaconda3\lib\multiprocessing\context.py", line 5, in <module>
from . import process
ImportError: cannot import name 'process'
あなたは私のPythonのインストールがあるまで見るディレクトリ!!!!なぜそこにそれが見えていますか?現在フリーズされたプログラムで、私がmyFrozenProgram/multiprocessing/
に行くと、Process.pyc
というファイルが見つかりました!
設定スクリプトは次のとおりです。過去に起こった問題のためにnumpyからカスタムdllを追加するので、これは通常より少し複雑です。また、TCLの一部は、私が原因TCLとエラーに追加:
import sys
import os
import json
import glob
from cx_Freeze import setup, Executable
from GUI.Meta import *
import os
PythonPath = os.path.split(sys.executable)[0] #get python path
os.environ['TCL_LIBRARY'] = os.path.join(PythonPath,"tcl","tcl8.6")
os.environ['TK_LIBRARY'] = os.path.join(PythonPath,"tcl","tk8.6")
mkl_files_json_file = glob.glob(os.path.join(PythonPath, "conda-meta","mkl-[!service]*.json"))[0] #json files that has mkl files list (exclude the "service" file)
with open(mkl_files_json_file) as file:
mkl_files_json_data = json.load(file)
numpy_mkl_dlls = mkl_files_json_data["files"] #get the list of files from the json data file
np_dlls_fullpath = list(map(lambda currPath: os.path.join(PythonPath,currPath),numpy_mkl_dlls)) #get the full path of these files
includefiles = [("GUI/icon.png","GUI/icon.png") + np_dlls_fullpath
target = Executable("Main.py",
#base = "Win32GUI",
icon = "GUI/icon.ico",
targetName="MyProg.exe")
setup(
name = "My program",
version = SOFTWARE_VERSION,
description = "Program",
options = {'build_exe': {'include_files':includefiles, 'includes': ["sip","re","atexit","PyQt5.QtCore","PyQt5.QtGUI","PyQt5.QtWidgets","multiprocessing"]}},
executables = [target])
この問題に従う人は https://bitbucket.org/anthony_tuininga/cx_freeze/issues/214/cx_freeze-keeps-looking-in-python-libs-not – TheONP