在 anaconda 环境中使用 pyinstaller

新手上路,请多包涵

我在 python(v 3.6) 上制作了一个非常简单的应用程序,我想使用 pyinstaller 冻结它。我使用 anaconda 创建的环境制作了该应用程序,并在那里安装了我需要的包 (youtube_dl)。我需要有关如何使用我创建的包含所有包的环境为我的应用程序 (Main.py) 使用 pyinstaller 的帮助。如果我运行“pyinstaller Main.py”我得到这个错误:

 Traceback (most recent call last):
  File "Main.py", line 7, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/PyInstaller/loader/pyimod03_importers.py", line 631, in exec_module
    exec(bytecode, module.__dict__)
  File "youtube_downloader.py", line 3, in <module>
ModuleNotFoundError: No module named 'youtube_dl'
[2708] Failed to execute script Main
logout

如何让 pyinstaller 使用我在 anaconda 目录中创建的环境?

原文由 Gonzalo 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 865
1 个回答

我通过发出 anaconda 提示重新安装 pyinstaller

conda install -c conda-forge pyinstaller

它对我有用。

原文由 piping piping 发布,翻译遵循 CC BY-SA 4.0 许可协议

推荐问题