![pip3 无法在 Windows 10 上的 Ubuntu 20.04 LTS 上创建虚拟环境,因为 Ensurepip 不可用](https://linux22.com/image/1172403/pip3%20%E6%97%A0%E6%B3%95%E5%9C%A8%20Windows%2010%20%E4%B8%8A%E7%9A%84%20Ubuntu%2020.04%20LTS%20%E4%B8%8A%E5%88%9B%E5%BB%BA%E8%99%9A%E6%8B%9F%E7%8E%AF%E5%A2%83%EF%BC%8C%E5%9B%A0%E4%B8%BA%20Ensurepip%20%E4%B8%8D%E5%8F%AF%E7%94%A8.png)
我在虚拟环境中工作Ubuntu 18.04 LTS但我卸载了它并安装了Ubuntu 20.04 LTS在 Windows 10 上,但现在当我创建时venv
,错误是
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.
当我安装sudo apt-get install python3-venv
它时,它说已安装但仍然很困难
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-venv is already the newest version (3.8.2-0ubuntu2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
答案1
我建议添加deadsnake-ppa并安装
sudo apt install python3.8-venv
答案2
在遇到同样的问题时偶然发现了这一点。
@alexandre-b 的回答帮我解决了这个问题。因为这个问题的搜索排名,我想在这里发帖。https://stackoverflow.com/a/56228901
基本上:
python3.* -m venv myvenv
*
你的具体 python 版本在哪里?
你可以使用以下命令检查你的 Python 版本
python3 --version
答案3
使用:
virtualenv my1
代替python3 -m venv my1
。cd my1
source bin/activate