Ubuntu-The virtual environment was not created successfully because ensurepip is not available

Ubuntu-The virtual environment was not created successfully because ensurepip is not available

在ubuntu18.04下创建python虚拟环境时遇到如下问题:

1
2
3
4
5
6
7
8
9
10
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/biso/env/nnunet/bin/python', '-Im', 'ensurepip', '--upgrade', '--default-pip']

首先通过安装:

1
apt-get install python3-venv

发现问题仍然没有解决。

网上寻找到StackOverflow的解决方案.:
在这里插入图片描述
发现仍然没有解决,后来在网上看到:
在这里插入图片描述
然后尝试下直接安装对应版本的python3-venv,在我这里安装的就是python3.7-venv,然后重新创建虚拟环境,问题解决。