简体   繁体   English

导入错误:没有名为 configobj 的模块

[英]ImportError: No module named configobj

I created .exe file using pyinstaller 3.3.1 and I got this message我使用pyinstaller 3.3.1创建了.exe文件,我收到了这条消息

Traceback (most recent call last):
File "install.py", line 14, in <module>
ImportError: No module named configobj
[8468] Failed to execute script install

I'm working with python 2.7 using conda environment.我正在使用conda环境使用python 2.7 Lately I had updated pyinstaller to version 3.3.1 so this happened to me while I'm checking that the update is safe.最近,我将pyinstaller更新到了version 3.3.1因此在我检查更新是否安全时发生了这种情况。

I have also created another .exe file from different script that uses also this import and its went well, so any help will be welcome.我还从不同的脚本中创建了另一个.exe文件,该文件也使用此import并且运行良好,因此欢迎提供任何帮助。

I got this error from certbot on Ubuntu 20.04 (focal).我从 Ubuntu 20.04(焦点)上的 certbot 收到此错误。 On this version of Ubuntu, python 2 seems to be mostly deprecated and many things don't work when using it.在这个版本的 Ubuntu 上,python 2 似乎大多已被弃用,并且在使用它时很多东西都不起作用。 Everything needs to be configured to use python3.一切都需要配置为使用python3。

When I ran certbot, it was still using python 2.当我运行 certbot 时,它仍在使用 python 2。

File "/usr/local/lib/python2.7/dist-packages/certbot/main.py", line 9, in <module>
    import configobj
ImportError: No module named configobj

Python 2 pip is no longer available from apt on this version of Ubuntu, so I was not able to install the proper libraries for python 2 using pip.在此版本的 Ubuntu 上,apt 不再提供 Python 2 pip,因此我无法使用 pip 为 python 2 安装正确的库。

The version of certbot in apt is supposed to be for python3. apt 中的 certbot 版本应该是用于 python3 的。 ( python3-certbot ). python3-certbot )。 The executable for certbot gets installed at /usr/bin/certbot . certbot 的可执行文件安装在/usr/bin/certbot

After further investigating, I found that I had an older python 2 version of certbot hanging around at /usr/local/bin/certbot .经过进一步调查,我发现我有一个旧的 python 2 版本的 certbot 挂在/usr/local/bin/certbot Once I removed that ( sudo rm /usr/local/bin/certbot ), the python3 version of certbot runs just fine and is able to find all its libraries.一旦我删除了它( sudo rm /usr/local/bin/certbot ), sudo rm /usr/local/bin/certbot的 python3 版本运行得很好并且能够找到它的所有库。

您需要通过 pip apt install python-pip安装 configobj

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

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