在将系统更新到 Ubuntu 20.04 后,我遇到了 Python 的各种问题。当前的问题是我无法创建虚拟环境:
python3 -m venv env
The virtual environment was not created successfully because ensurepip is not
available. On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.
apt-get install python3-venv
You may need to use sudo with that command. After installing the python3-venv
package, recreate your virtual environment.
Failing command: ['/home/XXX/my-project/env/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']
Run Code Online (Sandbox Code Playgroud)
要了解更多关于它失败的原因,我跑了
./env/bin/python3 -Im ensurepip --upgrade --default-pip:
/env/bin/python3: Error while finding module specification for 'ensurepip.__main__' (ImportError: …Run Code Online (Sandbox Code Playgroud) python3 ×1