Switch PyCharm venv to global env

In PyCharm, by default, a virtual environment is installed when you start a new project. In this virtual env (venv) are stored all the packages and the interpreter you are running for the current project.

Setup a new venv in PyCharm

Now, instead, you want to switch your project venv to your global env. So you should have an interpreter (usually) in /usr/bin/python3 and pip3 (the manager for the libs) in /usr/bin/pip3 (that you can normally run without being super user).

Your IDE should be like this now:

The easiest way is to delete the venv folder in your project structure and to setup a new one. So proceed deleting the “venv” folder.

I deleted the “venv” folder

and immediately should appear on your right side a popup asking you to setup a new python environment:

Configure a new Python interpreter popup

So, let’s tell PyCharm to use our default interpreter as interpreter for the project. By clicking on the popup, a new window will be promped out:

Simply click on “+” button and choose your Python interpreter located in /usr/bin/python3

In this way everything installed with pip3 will be used by our projects without installing every single package for each project.

Finally click “ok” and apply the changes and it will work like a (Py)charm! 😜

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.