简体   繁体   English

PyInstaller找不到PyYAML隐藏的导入

[英]PyInstaller can't find PyYAML hidden import

I am using PyInstaller to freeze a script that depends on PyYAML . 我正在使用PyInstaller冻结依赖于PyYAML的脚本。

I was getting the following error: 我收到以下错误:

ImportError: No module named 'yaml'

So I included yaml as a hidden import, but PyInstaller can't import it. 因此,我将yaml包含为隐藏的导入,但是PyInstaller无法导入它。

$ pyinstaller myapp.spec
...
2515 DEBUG: Hidden import: yaml
2516 INFO: Analyzing hidden import 'yaml'
2516 ERROR: Hidden import 'yaml' not found
...

So running my binary still fails with the same error. 因此,运行我的二进制文件仍然失败,并出现相同的错误。

PyYAML is installed on the active virtual environment, as other modules that don't fail when included on hidden imports. PyYAML已安装在活动虚拟环境中,其他模块在包含在隐藏导入中时也不会失败。 I've also tried to install it globally and even to install the python-yaml system package (Debian). 我也尝试过全局安装它,甚至安装python-yaml系统软件包(Debian)。

What am I doing wrong? 我究竟做错了什么?

I've solved it installing the python3-yaml system package. 我已经解决了安装python3-yaml系统软件包的问题。 My mistake was to install the Python2 version. 我的错误是安装Python2版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM