简体   繁体   中英

creating venv with python3.9 causes error

I'm relatively new with Python and I have been creating virtual environments for my different projects. If I use the following command:

python3 -m venv <name_of_env> 

this works and creates a virtual environment with python 3.8.5

However if I try the same command using -> python3.9 -m venv <name_of_env> it returns an error Error: Command '['/home/andrew/coding/pythonCourse/test_folder/tested_works/bin/testing_fails/bin/python3.9', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.

after this error it does create the folder but the bin file does not have the activate file and I cannot activate it.

Is the above method not suitable for python 3.9?. Using Conda I have no problems creating virtual environments with 3.9.

Thank you in advance for any advice.

You must install Python 3.9 venv:

sudo apt install python3.9-venv

Then just do

python3.9 -m venv .venv
.venv/bin/python --version

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM