Reputation: 131
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.
Upvotes: 11
Views: 18216
Reputation: 141
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
Upvotes: 14