我在虚拟环境中工作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