pycharm打包Python程序运行闪退的问题

当使用到第三方的包时,打包需要使用

pyinstaller -F -p c:\users\61790\appdata\local\programs\python\python37\lib\site-packages extract_pdf.py

使用-p 指定解释器包的路径,但是自己还遇到一个问题:

上面指定的是Python3.7的路径,但是打包过程中,输出如下:

140734 INFO: Loading module hook 'hook-difflib.py' from 'd:\\python3.8.2\\python38\\lib\\site-packages\\PyInstaller\\hooks'...

140745 INFO: Loading module hook 'hook-distutils.py' from 'd:\\python3.8.2\\python38\\lib\\site-packages\\PyInstaller\\hooks'...

140747 INFO: Loading module hook 'hook-distutils.util.py' from 'd:\\python3.8.2\\python38\\lib\\site-packages\\PyInstaller\\hooks'...

140756 INFO: Loading module hook 'hook-encodings.py' from 'd:\\python3.8.2\\python38\\lib\\site-packages\\PyInstaller\\hooks'...

140888 INFO: Loading module hook 'hook-heapq.py' from 'd:\\python3.8.2\\python38\\lib\\site-packages\\PyInstaller\\hooks'...

140896 INFO: Loading module hook 'hook-importlib_metadata.py' from 'd:\\python3.8.2\\python38\\lib\\site-packages\\PyInstaller\\hooks'...

140900 INFO: Loading module hook 'hook-importlib_resources.py' from 'd:\\python3.8.2\\python38\\lib\\site-packages\\PyInstaller\\hooks'...

可以看到输出了很多python3.8的包的路径,最终导致打包失败,原因是自己电脑上安装了多版本的python,但是pyinstaller是在python3.8下安装的,现在是在python3.7下运行的pyinstaller打包程序,所以最终会去python3.8中找到它的可执行程序,要改正这个错误,只需要在python3.7下安装pyinstaller包即可。

相关推荐
weixin_4407305030 分钟前
函数return、参数、参数组、递归函数、高阶函数等小结
开发语言·python
天赐范式44 分钟前
天赐范式第181天:让视图开始切换——PBFT视图切换与从safety到liveness的跨越
python·pbft·数字生命·天赐范式·动态运行时·拜占庭容错
sugarzhangnotes1 小时前
【无标题】
开发语言·人工智能·python
geovindu1 小时前
rust: Composite Pattern
开发语言·后端·设计模式·rust·组合模式
weixin_447195291 小时前
【无标题】
pytorch·python
迅猛龙办公室1 小时前
Python实现简单的人名对话
python
阿坨2 小时前
firestart:一行命令启动你的日常应用和网页
python·pypi·cli·click
老歌老听老掉牙2 小时前
麻花钻切屑形态演变的力学机制与临界条件分析
python·算法·钻头
周杰偷奶茶2 小时前
【Java】数组的定义和使用(附管理系统实战案例)
java·开发语言
happylifetree3 小时前
Python18(补充):练习
python