Python Virtualenv installation guide

keskiviikko 10. lokakuuta 2018

Virtualenv is a tool for Python that allows the easy creation of virtual python environments. We can have multiple different Python environments with different Python modules.
For the installation, we will use pip, a packet management tool that was installed with Python 3.

Instead of the traditional command prompt (cmd), we will use the newer Windows Powershell, that contains more UNIX-like commands, like ls. This is a personal preference, of course. So, let's start by writing 'powershell' to the Windows search and press Enter.


And this is what it looks like:

Now we are ready to start installing virtualenv!

1. Go to your folder of choice, for example: 
cd C:\Users\myname\Documents\

2. Install virtualenv with command:
pip install virtualenv

3. Create a new virtual environment named 'devenv' with command:
virtualenv devenv

Now, you should have a folder named 'devenv' that has local copies of Python tools.

4. Lastly, you have activate the virtual environment in Powershell., by being in the folder /devenv/ and writing the command:
./Scripts/activate

You can see that the virtualenv is activated, when the name of the environment in shown in braces () before the command line, for example:
 (devenv) PS C:\Users\myname\Documents

Last updated 10.10.2018

Ei kommentteja:

Lähetä kommentti