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
?
You put your python code inside the learning.python.
Your directory structure would look something like this:
If you run source .lpvenv/bin/activate
on Linux or OSX or .lpvenv\Scripts\activate.bat
on Windows, you will be using your venv interpreter, otherwise, you will be using your system interpreter.
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 in your project directory 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With