Skip to content

Instantly share code, notes, and snippets.

@TakingItCasual
Last active August 23, 2018 09:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TakingItCasual/9571002fd5d4031715269772eb547509 to your computer and use it in GitHub Desktop.
Save TakingItCasual/9571002fd5d4031715269772eb547509 to your computer and use it in GitHub Desktop.
Summary of youtube tutorial on python environments.

The video: https://www.youtube.com/watch?v=N5vscPTWKOk

This guide assumes environments are placed under ~/pyenvs/, and provides examples for an environment named ec2mc_env.

Installing virtualenv:

$ sudo pip install virtualenv

Making a directory (under the user's home directory) to hold the virtual environment(s):

$ mkdir pyenvs
$ cd pyenvs

Creating a virtual environment:

$ virtualenv ec2mc_env

Entering a virtual environment:

linux$ source ~/pyenvs/ec2mc_env/bin/activate
windows> %userprofile%\pyenvs\ec2mc_env\Scripts\activate.bat

(Linux) Creating a persistent alias to quickly enter an environment (https://askubuntu.com/a/17537/638387):

$ echo "alias ec2mc_env='source ~/pyenvs/ec2mc_env/bin/activate'" >> ~/.bash_aliases

For Windows persistent aliases, see this gist: https://gist.github.com/vladikoff/38307908088d58af206b

Exiting a virtual environment:

$ deactivate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment