pyinstaller Hidden import not found

 ̄綄美尐妖づ 提交于 2020-04-16 05:51:30

问题


I'm using pyinstaller. In my script there is:

import toml


config = toml.load('config.toml')

I compiled my script with:

pyinstaller main.py --onefile --clean --name myApp

but when I run the executable it gave me: ModuleNotFoundError: No module named 'toml'

So I tried this:

pyinstaller main.py --hidden-import toml --onefile --clean --name myApp

and now pyinstaller says: ERROR: Hidden import 'toml' not found


回答1:


Found the answer. If you are using a virtual environment (Like Pipenv, pyenv, venv) you need to run pyinstaller in the context of that environment. So...

pip install pyinstaller
python -m PyInstaller main.py ....


来源:https://stackoverflow.com/questions/57227191/pyinstaller-hidden-import-not-found

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