gpt4 book ai didi

python - 带有 Anaconda 3 和 Python 3.7 的 Pyinstaller 不起作用?

转载 作者:行者123 更新时间:2023-12-04 10:43:09 25 4
gpt4 key购买 nike

我刚安装了 Anaconda3 2019.10。然后在其中安装了一些 Python 库,它们是 requests、BeautifulSoup、PyInstaller。

所以来自 PyInstaller 的基础环境包含 Python 3.7.4。正如您从这里看到的:

(base) C:\>python
Python 3.7.4 (default, Aug 9 2019, 18:34:13) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

我在使用 Specfile 时遇到了 Pyinstaller 的问题。
所以我试图把它简化为一个最小的演示,我发现即使使用最简单的 Python 脚本,我也无法构建我的 Exe:

运行:
pyinstaller ibGetRuntimes.py --onefile

ibGetRuntimes.py:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
a = 1*1

当我这样做时,这个简单的脚本显然很有趣 python ibGetRuntimes.py .
但是在使用Pyinstaller的时候,会弹出这个错误:

enter image description here

由于它是全新安装的 Anaconda 和全新安装的 Pyinstaller,我正在努力找出根本原因。无法通过谷歌找到解决方案。

你有什么想法?

编辑
在我创建的 Python 2 环境下的 Pyinstaller 也能正常工作。

谢谢!

最佳答案

如果使用 PIP 安装,请首先使用 PIP 从根环境卸载 Pyinstaller。 PIP 包和 Conda 环境并不总是很好。他们在每次发布 Conda 时都在改进这一点,但它仍然会导致问题。

接下来,尝试为 Pyinstaller 创建一个新的 Conda 环境。 Pyinstaller 的最新版本在 conda-forge 上。然后切换到该环境并重试。

conda create -n pyexe requests beautifulsoup pyinstaller=3.6 -c defaults -c conda-forge
conda activate pyexe
pyinstaller ibGetRuntimes.py --onefile

这在与您自己的设置非常相似的设置上对我有用。

关于python - 带有 Anaconda 3 和 Python 3.7 的 Pyinstaller 不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59838507/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com