Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does it mean to "Inherit global site-packages" in PyCharm?

When creating a new Python project, why would I want to select this option? If I don't select it, what functionality am I missing out on? Would I not be able to import certain Python modules?

like image 455
Hayden Morgan Avatar asked Mar 08 '20 08:03

Hayden Morgan


People also ask

How do I add an existing VENV to PyCharm?

Open >> File >> Settings(Ctrl+Alt+S) >> Project: > Python Interpreter >> Right side of the Browse path select location of existing venv path >> Apply and OK.

How do I remove VENV from PyCharm?

You can clean out old PyCharm interpreters that are no longer associated with a project via Settings -> Project Interpreter, click on the gear in the top right, then click "More". This gives you a listing where you can get rid of old virtualenvs that PyCharm thinks are still around.


1 Answers

The other answers aren't quite accurate. The "inherit global site-packages" doesn't "pre-install" or "add packages" into your virtual environment. The settings gives your virtual environment access to the global site-packages.

https://www.jetbrains.com/help/pycharm/creating-virtual-environment.html

Select the Inherit global site-packages checkbox if you want that all packages installed in the global Python on your machine to be added to the virtual environment you're going to create. This checkbox corresponds to the --system-site-packages option of the virtualenv tool.

https://virtualenv.pypa.io/en/16.7.9/reference.html

--system-site-packages Give the virtual environment access to the global site-packages.

like image 107
Corey B Avatar answered Nov 14 '22 23:11

Corey B