Add Python Interpreter - Location Field?

In PyCharm 2024.1.4, I am at Settings for New Projects → Python Interpreter → Add Interpreter → Add Local Interpreter → Virtualenv Environment

The Location defaults to the user's home directory. This value would, theoretically, be used for every new project. If I'm wanting to  set up a VirtualEnv, however, I would expect the Location field to be blank or not even present, as it would be set individually for each project.

1. How is the Location field value used when setting up a virtual environment? 

2. What should it actually be set to?

 

0
4 comments
Hello,
Local venv default location is usually %project_dir%/venv. If you once create a venv outside %project_dir% (for example, /home/envs) IDE would suggest /home/venv/%project_name% further. 
So basically, the default location is your project root directory, you can change it by specifying other directory once.
0

Thanks for your insights, Daniil Bogdanov ! I still have the same question, though. 

I have set up `%project_dir%/venv` for my projects previously, so I understand that `venv` should go into my project's root directory. 

Now, I've discovered this other area, though - Settings for New Projects - that is supposed to be used to set up default settings for all projects. That's why I'm confused. There would not be a default `venv` directory for all projects - so what is the ‘Location’ field for on a window for setting up all new projects?

0
This option can be set, and newly opened projects will have this interpreter assigned by default. However, for creating new interpreters, aliases mentioned in my previous message will be used (project root dir or previous interpreter location).
0

Please sign in to leave a comment.