最近被环境问题搞怕了,特别是pyinstaller的打包问题,折腾了好久好久。为了避免下一次有这种库和库的冲突,可以采用这种方法。
pip freeze >requirements.txt #在当前目录获取已经安装的python插件
这个时候我们会在当前目录生成一个requiremengt.txt的文件。
我的如下
altgraph==0.17
certifi==2020.12.5
cffi==1.14.4
chardet==4.0.0
comtypes==1.1.8
crypto==1.4.1
cycler==0.10.0
future==0.18.2
idna==2.10
iso8601==0.1.13
kiwisolver==1.3.1
matplotlib==3.1.1
Naked==0.1.31
numpy==1.19.5
pandas==0.25.3
pefile==2019.4.18
Pillow==8.1.0
psutil==5.8.0
PyAudio==0.2.11
pycaw==20181226
pycparser==2.20
pycryptodome==3.9.9
PyInstaller==3.6
pyparsing==2.4.7
pyserial==3.5
python-dateutil==2.8.1
pytz==2020.5
pywin32==300
pywin32-ctypes==0.2.0
PyYAML==5.3.1
requests==2.25.1
scipy==1.5.4
serial==0.0.97
shellescape==3.8.1
six==1.15.0
sounddevice==0.4.1
SoundFile==0.10.3.post1
urllib3==1.26.4
WMI==1.5.1
XlsxWriter==1.3.7
这个是我项目能成功用pyinstaller打包exe并不报错的环境
那么,下次我在配置新环境时,可以直接用以下命令快速配置环境
pip install -r requirements.txt #在requirements.txt目录下运行
感觉填完了这次pyinstaller的坑,自己的填坑技术又有了质的飞跃