Mutating Algorithm Mutating Algorithm - 1 month ago 6
Python Question

Where do I store my python program files when using a virtual environment?

I created a virtual environment called

.lpvenv
which contains dependencies for my project. On windows,
.lpvenv
is basically a folder. Do I store my source code directly in this folder when working inside
.lpvenv
or does it not matter ?

Let's say I have a folder learning.python, inside this folder i have
.lpvenv
do i put my source code in learning.python or inside
.lpvenv
?

Answer

The environment folder should never be touched. It's there to store the specific version of python as well as the modules you install into that environment. All of this is managed by PIP.

You can put your code anywhere you want as long as you call the .lpenv/bin/activate script to activate your environment first. However, most projects put the environment right next to their source code within their project folder, which would be learning.python in your case.

If you're using version control such as Git, make sure you add .lpenv to your .gitignore file. You do not want to commit your environment into source code since it should be easily rebuilt using your requirements.txt file.