pip3 无法在 Windows 10 上的 Ubuntu 20.04 LTS 上创建虚拟环境,因为 ensurepip 不可用

Ali*_*Ali 3 ubuntu pip python-venv

我正在使用Ubuntu 18.04 LTS 的虚拟环境,但我卸载了它并在 Windows 10 上安装了Ubuntu 20.04 LTS,但是现在当我创建时,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.
Run Code Online (Sandbox Code Playgroud)

当我安装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.
Run Code Online (Sandbox Code Playgroud)

Pra*_*ath 9

我在 Ubuntu 20.04 WSL2 Win10 build 2004 上遇到了同样的问题,当我尝试在 D:\ 驱动器上创建虚拟环境时,它是 /mnt/d [NTFS]。通过卸载和重新安装元数据,我能够使用以下命令解决它

sudo umount /mnt/d
sudo mount -t drvfs D: /mnt/d -o metadata
Run Code Online (Sandbox Code Playgroud)

  • 尝试了很多不同的方法,终于成功了,谢谢 (2认同)