Using pyinstaller with anaconda environment

折月煮酒 提交于 2020-07-05 11:40:08

问题


I have a very simple application made on python(v 3.6), and I wanted to freeze it using pyinstaller.I have made the app using an environment created with anaconda, and I installed there the packages I needed(youtube_dl). I need help on how to use pyinstaller for my app(Main.py) using the environment I created with all its packages inside it. If I run "pyinstaller Main.py" I get this error:

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

How can I make pyinstaller use the environment I created at anaconda´s directory?


回答1:


Looks like you installed the youtube_dl in the anaconda environment and you are running the pyinstaller outside the anaconda environment and it can't find the needed module. Did you try just doing pip install youtube_dl before pyinstaller Main.py?




回答2:


I reinstalled pyinstaller from anaconda prompt by issuing

conda install -c conda-forge pyinstaller

and it worked for me .



来源:https://stackoverflow.com/questions/50411931/using-pyinstaller-with-anaconda-environment

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!