#2 编辑-解决方案:
所以我找到了一些可以修复它的方法:https://stackoverflow.com/a/63207387/12291295
如果你之后得到
ModuleNotFoundError:没有名为“zlib”的模块
错误,尝试这个:https://stackoverflow.com/a/62831268/12291295
python3 -m venv env
我正在尝试使用或创建一个 venvpython3.8 -m venv venv
但出现错误:
Error: Command '['<some_prior_path>/env/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.
与 python3.8 相同<some_prior_path>/env/bin/python**3.8**
但如果我尝试,python3.6 -m venv env
它就会按计划执行,然后我就可以激活 venv。
Ubuntu 版本
Release: 18.04
Python版本:
python3 -V
Python 3.8.0
我尝试过的事情:
取自 :https://stackoverflow.com/a/62815398/12291295
sudo apt install python3.8 python3.8-venv
&
apt install python3.8 python3.8-venv python3-venv
返回所有内容已安装并更新。
pip install --user virtualenv
返回:
Requirement already satisfied: virtualenv in /usr/local/lib/python3.6/dist-packages (20.0.31)
Requirement already satisfied: filelock<4,>=3.0.0 in /usr/local/lib/python3.6/dist-packages (from virtualenv) (3.0.12)
Requirement already satisfied: appdirs<2,>=1.4.3 in /usr/local/lib/python3.6/dist-packages (from virtualenv) (1.4.4)
Requirement already satisfied: distlib<1,>=0.3.1 in /usr/local/lib/python3.6/dist-packages (from virtualenv) (0.3.1)
Requirement already satisfied: importlib-resources>=1.0; python_version < "3.7" in /usr/local/lib/python3.6/dist-packages (from virtualenv) (3.0.0)
Requirement already satisfied: six<2,>=1.9.0 in ./.local/lib/python3.6/site-packages (from virtualenv) (1.13.0)
Requirement already satisfied: importlib-metadata<2,>=0.12; python_version < "3.8" in /usr/local/lib/python3.6/dist-packages (from virtualenv) (1.7.0)
Requirement already satisfied: zipp>=0.4; python_version < "3.8" in /usr/local/lib/python3.6/dist-packages (from importlib-resources>=1.0; python_version < "3.7"->virtualenv) (3.2.0)
我认为问题就在这里,我不知道如何使它适用于每个 python3 版本,我的意思是为什么它不位于/usr/bin/python3
?
编辑
pip 似乎默认安装的是 python3.6 版本,当我尝试
python3.8 -m pip install pip
我得到:
/usr/local/bin/python3.8: No module named pip