How to Manage Python Virtual Environments in PyCharm

Creating virtual environments on Windows can be challenging. (There is an easier way on Linux and Mac.) When on Windows, PyCharm can help you set up and manage your virtual environments.

If you don't already have it, get the free community edition version of PyCharm.

To create a new virtualenv, go to File -> Settings, and search for project interpreter like in the screenshot below.

pycharm-project-interpreter.png

Look for the gear icon on the top right:

PyCharm virtualenv

Click the gear, and choose what you want to do:

pycharm-choose-virtual-env.png

When you create a new virtualenv, it will look something like the screenshot below.

mkvirtualenv

The next thing to do is install any required packages. Look for the plus sign on the right:

pycharm-virtualenv-install-package.png

You can then search for the needed package and install it:

pycharm-install-package.png

More information here.

If you have any questions, leave a comment below.