Fundamentals 6 min read

Master Python Virtual Environments with virtualenv and PyCharm on Windows

This guide walks you through installing virtualenv, creating and activating Python 3.6 virtual environments on Windows, and integrating them seamlessly into PyCharm, helping you manage multiple Python versions for projects such as sentiment analysis with TensorFlow.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Master Python Virtual Environments with virtualenv and PyCharm on Windows

1. Installing virtualenv

virtualenv can be installed like any other Python package, either via pip or from source.

1.1 Install with pip

pip install virtualenv

To uninstall, run pip uninstall virtualenv. If pip is not available, use the source method below.

1.2 Install from source

Download the latest tar.gz from the official site, extract it, then run: c:\virtualenv-15.1.0>python setup.py install If pip is missing, install the latest pip tar.gz first.

2. Configuring a Python virtual environment

Use virtualenv to create an isolated environment for a specific project directory and Python version. For example, to set up a Python 3.6 environment for c:\PythonProj\sjtu-cs: virtualenv -p c:\Python36\python.exe HigEnv The -p flag specifies the Python executable; HigEnv is the name of the new environment.

3. Activating the virtual environment

c:\PythonProj\sjtu-cs>cd HigEnv\Scripts
c:\PythonProj\sjtu-cs\HigEnv\Scripts>activate

After activation, you can run Python commands, e.g.: >>> python "hello ,world" To deactivate, simply run:

(HigEnv) c:\PythonProj\sjtu-cs\HigEnv\Scripts>deactivate

4. Using virtualenv in PyCharm

PyCharm integrates virtualenv, so you often do not need to install it manually.

4.1 Create a new project and select the Python version

When importing an existing project, PyCharm auto‑detects the matching interpreter, but you can also choose a different one.

4.2 Create a virtualenv interpreter in PyCharm

In the project settings, add a new interpreter and let PyCharm create a virtualenv for you, or point it to an existing environment.

Alternatively, you can skip creating a new environment and directly select the desired interpreter for the project.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

DevelopmentPythonWindowsPyCharmvirtualenvEnvironment
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.