Issue
If I created a virtual environment using python3 -m virtualenv [name]
does this simply use the global version of python? If say, in 10 years time when we might all be using python 4 will running my code in the virtual environment I created today try to run the code in python4?
I read somewhere on stackoverflow that you can specify a version of python like this... virtualenv --python="/usr/bin/python2.6" "/path/to/new/virtualenv/"
.
Will this second method make it so not matter when I try to run the code the virtual environment will have everything needed to make it run without errors?
I'm new to coding though I did play about with Visual C++ 2010 when it was current. I couldn't get any of that code to run when I tried it recently and I don't want the same to happen again!
Many thanks
Solution
virtualenv
is a tool for creating isolated python environments, if you need to create a virtualenv with specific version of python, you can run the following command.
virtualenv myvenv -p3.10
This will check your system for any python3.10
installations, and if found, it will successfully create a virtual environment, else:
RuntimeError: failed to find interpreter for Builtin discover of python_spec='3.10'
which implies that you need to have the specific version installed in your system.
Answered By - Jithin Johnson Answer Checked By - Marilyn (WPSolving Volunteer)