我已经用Pyinstaller创建了一个可执行文件。从cmd运行可执行文件时,它在开始创建relplot时崩溃。为了创建exe,我使用了以下命令:pyinstaller test.py --onefile
。下面是test.py:
#!/usr/bin/env python
import seaborn as sns
print('###################relplot##########################')
tips = sns.load_dataset("tips")
g = sns.relplot(data=tips, x="total_bill", y="tip", hue="day")
g.fig.savefig('.\\test.png')
print('success')
康达信息:
shell level : 2
conda version : 4.9.2
conda-build version : 3.20.5
python version : 3.8.5.final.0
virtual packages : __cuda=11.1=0
__win=0=0
__archspec=1=x86_64
platform : win-64
user-agent : conda/4.10.1 requests/2.25.1 CPython/3.8.8 Windows/10 Windows/10.0.19041
administrator : False
netrc file : None
offline mode : False
Pyinstaller warning file when the .exe is built.
Pyinstaller debug messages at runtime带有--debug=imports
请参见底部崩溃的地方
我尝试过更新环境和库,编写疯狂的.spec文件。似乎什么都不管用。我知道this post.但是解决方案不起作用,这个问题没有得到太多的关注,而且它不完整,我不能给它留下评论,对我来说,它似乎与我的问题略有不同
更新:exe文件在Anaconda提示符中运行时没有问题,但在cmd中崩溃。我尝试了提供的解决方案,但没有成功
Conda虚拟环境Python 3.7.10:
name: test_env
channels:
- defaults
dependencies:
- altgraph=0.17=pyhd3eb1b0_0
- blas=1.0=mkl
- ca-certificates=2021.1.19=haa95532_1
- certifi=2020.12.5=py37haa95532_0
- cycler=0.10.0=py37_0
- freetype=2.10.4=hd328e21_0
- future=0.18.2=py37_1
- icc_rt=2019.0.0=h0cc432a_1
- icu=58.2=ha925a31_3
- intel-openmp=2020.2=254
- jpeg=9b=hb83a4c4_2
- kiwisolver=1.3.1=py37hd77b12b_0
- libpng=1.6.37=h2a8f88b_0
- macholib=1.14=pyhd3eb1b0_1
- matplotlib=3.2.2=0
- matplotlib-base=3.2.2=py37h64f37c6_0
- mkl=2020.2=256
- mkl-service=2.3.0=py37h196d8e1_0
- mkl_fft=1.3.0=py37h46781fe_0
- mkl_random=1.1.1=py37h47e9c7a_0
- numpy=1.19.2=py37hadc3359_0
- numpy-base=1.19.2=py37ha3acd2a_0
- openssl=1.1.1k=h2bbff1b_0
- pandas=1.2.3=py37hf11a4ad_0
- pefile=2019.4.18=py_0
- pip=21.0.1=py37haa95532_0
- pycryptodome=3.10.1=py37h2bbff1b_0
- pyinstaller=3.6=py37h8cc25b3_6
- pyparsing=2.4.7=pyhd3eb1b0_0
- pyqt=5.9.2=py37h6538335_2
- python=3.7.10=h6244533_0
- python-dateutil=2.8.1=pyhd3eb1b0_0
- pytz=2021.1=pyhd3eb1b0_0
- pywin32=227=py37he774522_1
- pywin32-ctypes=0.2.0=py37_1001
- qt=5.9.7=vc14h73c81de_0
- scipy=1.6.2=py37h14eb087_0
- seaborn=0.10.1=py_0
- setuptools=52.0.0=py37haa95532_0
- sip=4.19.8=py37h6538335_0
- six=1.15.0=py37haa95532_0
- sqlite=3.35.4=h2bbff1b_0
- tornado=6.1=py37h2bbff1b_0
- vc=14.2=h21ff451_1
- vs2015_runtime=14.27.29016=h5e58377_2
- wheel=0.36.2=pyhd3eb1b0_0
- wincertstore=0.2=py37_0
- zlib=1.2.11=h62dcd97_4
prefix: C:\Users\alina\.conda\envs\test_env
经过多次测试,我意识到只有在使用
conda
环境创建可执行文件时才会发生这种情况。我只是创建了一个venv
而不是一个conda
环境,一切都很顺利。如果您希望使用pyinstaller
分发Python应用程序,我建议您尽可能远离conda
环境相关问题 更多 >
编程相关推荐