ImportError: unable to find Qt5Core.dll on PATH
当前文件夹下新建这个py文件
# Fix qt import error
# Include this file before import PyQt5
import os
import sys
import logging
def _append_run_path():
if getattr(sys, 'frozen', False):
pathlist = []
# If the application is run as a bundle, the pyInstaller bootloader
# extends the sys module by a flag frozen=True and sets the app
# path into variable _MEIPASS'.
pathlist.append(sys._MEIPASS)
# the application exe path
_main_app_path = os.path.dirname(sys.executable)
pathlist.append(_main_app_path)
# append to system path enviroment
os.environ["PATH"] += os.pathsep + os.pathsep.join(pathlist)
logging.error("current PATH: %s", os.environ['PATH'])
_append_run_path()
然后导入到你当前的py文件中
import fix_qt_import_error
再运行
pyinstaller -F xxx.py
问题2:
pyinstallers生成exe文件打开时报错:no module named 'pkg_resources.py2_warn'