Virtual environment (Python)

Create a virtual environment for your Python app in a few steps. (For Linux and OS X). Go inside the directory where you want your virtual environment and type in the terminal:

This command will create a directory called myvenv with the virtual environment.

Start your virtual environment by running:

Now that you inside the virtual environment (you will know it because the prompt of the console is prefixed with ( myenv )) you can install whatever you need using pip. To get the latest version of pip type:

When working within a virtual environment, python will automatically refer to the correct version so you don’t need to specify anything.

Create a requirements.text file and add packages inside.

Run the following to install them:

The end! Happy coding!