Python

[Python] the virtual environment was not created successfully because ensurepip is not available.

학학이 2021. 4. 14. 11:51
$ python --version
Python 3.8.0

$ python3 --version
Python 3.6.9

한 OS에서 여러 버전의 Python이 설치된 경우 발생함

 

$ python3.8 -m venv .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.

Failing command: ['/home/lsh/metal-api/.venv38/bin/python3.8', '-Im', 'ensurepip', '--upgrade', '--default-pip']

 

python3-venv 설치하라고 나오지만, python3.8을 사용한다면 아래와 같이 python3.8-venv를 설치해야 한다.

$ apt-get install python3-venv

$ apt-get install python3.8-venv