I am making a GUI project and I stuck while finding the python interpreter in my virtual environment.
Execute next code and it will print location of your python interpreter.
import sys
print(sys.executable)
To a lot of extents, it depends on how the virtual environment was created. If you installed like this py -m venv env
then you would find it here .\\env\\Scripts\\activate
. How ever if you created the environment using conda then you would find it here Anaconda_installation_folder/envs/name_of_environment
. SO brief answer to your question, you would find it withing you env folder.
If you want to automatically active virtual env or (venv). Try this.
Install virtual env
python3 -m venv venv
If you have already have venv present. you can refer use this to get the executable python3 file like this.
#referred @Arty answer above.
import sys
print(sys.executable)
this will print the python3 path of that venv.
later open command pallet ( ctrl + shift + P
) and type python
as shown in image.
Then click on
and paste that path into the input box.
Now the setup is done. Now every time you open a terminal, it will automatically open your terminal in the virtual env, and will auto-run the virtual env for you.
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.