익명 12:07

Cannot create a virtual enviroment with Python 3.8.10 on Ubuntu 20.04

Cannot create a virtual enviroment with Python 3.8.10 on Ubuntu 20.04

When I type the command sudo python3 -m venv venv001 I get this error:

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

You may need to use sudo with that command.  After installing the python3-venv package, recreate your virtual environment.

Failing command: ['/home/mike/venv001/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']

so, I try sudo apt install python3.8-env and get the error message:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 python3.8-venv : Depends: python3.8 (= 3.8.2-1ubuntu1) but 3.8.10-0ubuntu1~20.04 is to be installed
E: Unable to correct problems, you have held broken packages.

I've tried a couple of the sudo apt install -f, or --fix- commands, but still can't seem to recover from these errors.



Top Answer/Comment:

You can install python3 virtual environment with below command

sudo apt install python3-virtualenv

Later you can create the virtual environment with below command

virtualenv apienv
상단 광고의 [X] 버튼을 누르면 내용이 보입니다