0

I am pretty early in my coding career, and I'm trying to understand how the programs I write are integrated with my computer and the virtual environment. I am specifically curious about where pip installed packages exist in my computer's memory.

I use python 3.9 on the latest version of PyCharm.

For each project I start, PyCharm seems to set up and save a copy of a new virtual environment every time. Each new package I download in a project appears to have a copy of itself saved in the venv as well.

Is this an accurate understanding of what is going on? Is the environment and packages and all their code being copied and saved every time, or is it pointing to something behind the scenes to improve memory-efficiency?

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
  • Virtualenvs are recommended, but optional, by the way – OneCricketeer Sep 24 '21 at 20:24
  • this will help [What is a virtualenv, and why should I use one?](https://stackoverflow.com/questions/41972261/what-is-a-virtualenv-and-why-should-i-use-one) – deadshot Sep 24 '21 at 20:25
  • pip installed packages do not exist in your computer's memory. They exist on your computer's hard disk. Too many people miss that distinction. – Tim Roberts Sep 24 '21 at 20:25

1 Answers1

-1

In Windows, Python install by default in C: drive
In Linux, Python install by default in local/bin/
Packages will be install where your python is located.


PyCharm creates virtual environment individually for a project. You can install specific packages related to your program.
For example: You are working on GUI you need to install (Tkinter, PyQt5, Kivy, etc). When you create a new project then it creates virtual environment as venv in your project directory where you can install package for your specific project.
Conclusion:
  • It helps you to understand which packages are used in your project.

  • You can easily create requirements.txt where your used packages with versions is stored (mostly used for deploy your app).

     pip freeze > requirements.txt