导入错误:无法从“virtualenv”

时间:2021-05-25 19:16:40

标签: python-3.x virtualenv ubuntu-20.04 virtualenvwrapper

我已经安装了 virtualenvwrapper

我将我的 Ubuntu 更新到 20.04。 Python 版本在升级到 Python 3.8.5

时默认更改

当我使用 workon myenv

检查 python -V 它显示 Python 3.6.7

当我检查 pip list 内的 myenv 时,我收到此消息

Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00007f841871d740 (most recent call first):
Aborted (core dumped)

我尝试创建新的 virtualenv mkvirtualenv -p python3 newenv

我明白了Import Error

Traceback (most recent call last):
  File "/home/abcd/.local/bin/virtualenv", line 7, in <module>
    from virtualenv import main
ImportError: cannot import name 'main' from 'virtualenv' (/usr/lib/python3/dist-packages/virtualenv/__init__.py)

我该如何解决这个问题?

删除了pip uninstall virualenv virtualenvwrapper

然后重新安装python -m pip install virtualenv virtualenvwrapper

没有解决问题,请帮忙

0 个答案:

没有答案