[英]PyInstaller: ModuleNotFoundError: No module named 'encodings'
I have a GUI application made using PySide2 and it some major modules it uses are OpenVino(2019), dlib, OpenCV-contrib(4.2.x) and Postgres(psycopg2) and I am trying to freeze the application using PyInstaller (--debug is True).我有一个使用 PySide2 制作的 GUI 应用程序,它使用的一些主要模块是 OpenVino(2019)、dlib、OpenCV-contrib(4.2.x) 和 Postgres(psycopg2),我正在尝试使用 PyInstaller (--debug) 冻结应用程序是真的)。
The program gets frozen without errors but during execution, I get the following error:程序被冻结而没有错误,但在执行过程中,我收到以下错误:
Fatal Python error: initfsencoding: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings'
after which the application exits.之后应用程序退出。
I have tried many suggestions provided in other stackoverflow questions/github issues but none of them have worked.我尝试了其他 stackoverflow 问题/github 问题中提供的许多建议,但都没有奏效。
I have python version 3.7.6 but I have also tried with 3.6.8 (both local installation and after creating new venv in pycharm).我有 python 版本 3.7.6,但我也尝试过 3.6.8(本地安装和在 pycharm 中创建新的 venv 之后)。 I have tried different versions of pycharm as well(it shows som other errors below 3.5).
我也尝试过不同版本的 pycharm(它显示了低于 3.5 的其他错误)。 I have tried pycharm 3.6 both develop branch and master branch.
我已经尝试过 pycharm 3.6 的开发分支和主分支。
I have checked my PYTHONPATH and PYTHONHOME in env variables, they are pointing to python's location.我已经在 env 变量中检查了我的 PYTHONPATH 和 PYTHONHOME,它们指向 python 的位置。
I have modified my specfile to include the necessary binaries, files, imports and folders.我修改了我的规范文件以包含必要的二进制文件、文件、导入和文件夹。 I would share it if needed.
如果需要,我会分享它。 Also any other logs during build or execution.
还有构建或执行期间的任何其他日志。
I would like to know what I should do to solve this, wheather this issue is because of some component or is this a PyInstaller issue, and if so, should I raise it on github.我想知道我应该怎么做来解决这个问题,这个问题是因为某个组件还是 PyInstaller 问题,如果是这样,我应该在 github 上提出它。
My os is windows 10.我的操作系统是 Windows 10。
You changed the python version.您更改了python版本。 So, you have to give a new path according to the Python version.
所以,你必须根据 Python 版本给出一个新路径。 Just remove all older version and the current one and reinstall new Python v.3.8.1
只需删除所有旧版本和当前版本并重新安装新的 Python v.3.8.1
您需要在应用程序文件夹中包含 base_library.zip
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.