Python 没有名为';编码';

Python 没有名为';编码';,python,Python,我的操作系统是Ubuntu 17.10 我正在尝试运行(和开发)一个python项目,但当我这样做时,我得到: Fatal Python error: Py_Initialize: Unable to get the locale encoding ModuleNotFoundError: No module named 'encodings' Current thread 0x00007f8c459bf740 (most recent call first): 我尝试了以下方面的建议: 我

我的操作系统是Ubuntu 17.10

我正在尝试运行(和开发)一个python项目,但当我这样做时,我得到:

Fatal Python error: Py_Initialize: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00007f8c459bf740 (most recent call first):
我尝试了以下方面的建议:

  • 我已经移除了旧的虚拟环境
  • 创建一个名为
    venv
  • 运行
    source-venv/bin/activate
  • pip安装-r requirements.txt
  • 另外,在pycharm中,我已经使用了文件>设置>项目>项目中断器-并将其设置为使用相同的虚拟环境

    我还尝试了
    sudo dpkg重新配置python3


    但我仍然收到相同的错误。

    我发现,在设置uwsgi时,此消息是由指向“.ini”文件中虚拟环境的无效指针引起的。

    我在更新到macOS Catalina后遇到了类似的问题“ModuleNotFoundError:没有名为“encodings”的模块”

    我的系统中安装了多个版本的Python

    从macOS系统中删除所有python版本(2.7和3.7.4)并重新安装最新的Python3.8对我来说很有用


    要从macOS中删除python,我已经按照这里的说明进行了操作

    我可以知道您使用的python版本吗@MagickI正在使用Python 3.6.3try调用pip最安全的方法是
    Python-m pip install-r requirements.txt
    100%我对我的virtualenv有错误的权限,这条评论让我对此进行了评估。成功了。非常感谢。