[python]使用pyinstaller打包pyqt5设计的窗体在其他机器上运行报错
本帖最后由 可塑型芋头 于 2023-2-2 09:11 编辑问题描述:
使用pyinstaller打包exe文件,在打包的电脑上可以运行,但在全新安装的虚拟机上无法运行。
pyinstaller命令试过:pyinstaller -Fw main.py;pyinstaller -Fw main.py --path D:\anaconda3_86\Lib\site-packages\PyQt5\Qt5\bin 都不行。
错误截图:
打包时日志文件:
missing module named org - imported by pickle (optional)
missing module named 'org.python' - imported by copy (optional), xml.sax (delayed, conditional)
missing module named _frozen_importlib_external - imported by importlib._bootstrap (delayed), importlib (optional), importlib.abc (optional), zipimport (top-level)
excluded module named _frozen_importlib - imported by importlib (optional), importlib.abc (optional), zipimport (top-level)
missing module named pyimod02_importers - imported by D:\anaconda3_86\Lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth_pkgutil.py (top-level)
missing module named _scproxy - imported by urllib.request (conditional)
missing module named termios - imported by getpass (optional)
missing module named pwd - imported by posixpath (delayed, conditional), shutil (optional), tarfile (optional), pathlib (delayed, conditional, optional), netrc (delayed, conditional), getpass (delayed)
missing module named grp - imported by shutil (optional), tarfile (optional), pathlib (delayed)
missing module named vms_lib - imported by platform (delayed, conditional, optional)
missing module named 'java.lang' - imported by platform (delayed, optional), xml.sax._exceptions (conditional)
missing module named java - imported by platform (delayed)
missing module named _winreg - imported by platform (delayed, optional), selenium.webdriver.firefox.firefox_binary (delayed, optional)
missing module named _posixsubprocess - imported by subprocess (optional)
missing module named _uuid - imported by uuid (optional)
runtime module named urllib3.packages.six.moves - imported by http.client (top-level), urllib3.util.response (top-level), urllib3.connectionpool (top-level), 'urllib3.packages.six.moves.urllib' (top-level), urllib3.util.queue (top-level)
missing module named StringIO - imported by PyQt5.uic.port_v2.string_io (optional), urllib3.packages.six (conditional)
missing module named 'backports.ssl_match_hostname' - imported by urllib3.packages.ssl_match_hostname (optional)
missing module named "'urllib3.packages.six.moves.urllib'.parse" - imported by urllib3.request (top-level), urllib3.poolmanager (top-level)
missing module named Queue - imported by urllib3.util.queue (conditional)
missing module named 'typing.io' - imported by importlib.resources (top-level)
missing module named cStringIO - imported by xlrd.timemachine (conditional), PyQt5.uic.port_v2.string_io (optional)
missing module named copy_reg - imported by cStringIO (top-level)
missing module named port_v2 - imported by PyQt5.uic.properties (conditional)
missing module named posix - imported by os (conditional, optional), shutil (conditional)
missing module named resource - imported by posix (top-level)
部分导包源码:
import os
import sys
import time
from shutil import copyfile
import xlrd
from PyQt5.QtCore import QDate, QDir
from PyQt5.QtWidgets import QApplication, QMainWindow, QFileDialog, QLineEdit, QMessageBox
from PyQt5.uic.properties import QtCore
from selenium.webdriver.support.select import Select
from auto_chuna_ui import Ui_MainWindow
from selenium import webdriver
options = webdriver.ChromeOptions()
# options.add_argument('--headless')
options.add_argument("--remote-debugging-port=9222")
# options.headless = True# todo debug时加上注释
options.add_experimental_option('detach', True)# 设置不自动关闭浏览器,可以放在函数内,但会重复生成浏览器窗口
driver = webdriver.Chrome(options=options)
其他说明:
打包的系统中找不到C:\Users\JAHON_~1\AppData\Local\Temp\_MEI21522\PyQt5\Qt5\bin这个文件夹或文件。
找不到指定应用程序:C:\Users\JAHON_~1\AppData\Local\Temp\_MEI21522\PyQt5\Qt5\bin这个文件夹,在打包的目录里面有这个\PyQt5\Qt5\bin文件夹的,如果能在哪里改过来或许可以解决,但是找不到这条代码的位置,在我写的代码里没有这个路径的指定。 本帖最后由 可塑型芋头 于 2023-2-3 14:30 编辑
求助求助,自顶一下~ 记得遇到过这个问题, 如果是虚拟环境打包会出现这情况.. 大概意思就是 这个文件没有一起打包..你把这个文件夹在的所有文件一起添加到 pyinstaller 就好了..或者把pyqt5加个系统全局path goodidea0906 发表于 2023-2-19 20:31
记得遇到过这个问题, 如果是虚拟环境打包会出现这情况.. 大概意思就是 这个文件没有一起打包..你把这个文件 ...
用的是base环境。然后pyqt5也加入了系统变量里了:'(weeqw
页:
[1]