【问题标题】:Using pyinstaller with anaconda environment在 anaconda 环境中使用 pyinstaller
【发布时间】:2018-10-28 22:20:56
【问题描述】:

我在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 目录中创建的环境?

【问题讨论】:

    标签: python conda pyinstaller


    【解决方案1】:

    看起来您在 anaconda 环境中安装了youtube_dl,并且您在 anaconda 环境之外运行 pyinstaller 并且找不到所需的模块。你试过在pyinstaller Main.py之前只做pip install youtube_dl吗?

    【讨论】:

    • 是的!谢谢,这对我有用。但是,我总是使用 anconda 环境来避免包之间的冲突,所以,你知道我怎么能在那个 anaconda 环境中使用 pyinstaller 吗?无论如何,谢谢老兄!
    • 你好,可能你可以在 anaconda 环境中安装 pyinstaller 并从那里运行它。自己没有尝试过,但应该可以。
    【解决方案2】:

    我通过发布从 anaconda 提示符重新安装了pyinstaller

    conda install -c conda-forge pyinstaller

    它对我有用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-08-29
      • 1970-01-01
      • 2019-01-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-04-20
      • 2020-10-18
      相关资源
      最近更新 更多