Skip to content

Instantly share code, notes, and snippets.

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 goobta/ae93aa5d7130500fbbf7910041a2bc59 to your computer and use it in GitHub Desktop.
Save goobta/ae93aa5d7130500fbbf7910041a2bc59 to your computer and use it in GitHub Desktop.
Installing a python environment

Foreword

I constantly find myself rewriting these instructions over and over again, so I figured that I'll write 'em once and reference this document when needed.

Assumptions

  • There is a file in the root directory named requirements.txt. This file should be hold all of the packages required for the project. This file can be generated by running pip freeze > requirements.txt on UNIX based systems.
  • That the project is using Python 3. Most of my projects are written in Python 3, so this condition will usually be true. If this not the case, it will be explictly written as such in the README.md. The only major change to use Python 2 is to replace python=3 with python=2 when the step comes.

Directions

If you already have pip installed (Just try running pip from the command line), simply run pip install -r requirements.txt.

If not, then you will have to install pip. You can either just install pip by itself, but we recommend installing anaconda, which will sandbox your python installation so that it won't interfere with anything else on your system.

Install anaconda for your respective operating system by following this. Once conda is installed, create a new conda environment that uses python 3. For most systems, this is done by conda create --name <ENV NAME> python=3. In this case, <ENV NAME> can be whatever you want; usually, I make it the name of my project.

After the environment has been properly set up, run source activate <ENV NAME> to activate the environment. You should see a (<ENV NAME>) on the very left of your prompt. Then run pip install -r requirements.txt.

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