Skip to content

Instantly share code, notes, and snippets.

@davydka
Last active October 28, 2018 22:11
Show Gist options
  • Save davydka/c09670b7c902e2882549157ee5f09b5e to your computer and use it in GitHub Desktop.
Save davydka/c09670b7c902e2882549157ee5f09b5e to your computer and use it in GitHub Desktop.
python dev setup

specify python version for NPM


OSX

Python3 and Virtualenv Setup

  • install homebrew
  • brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb to install python 3.6.5
  • pip3 install virtualenv
  • pip3 install virtualenvwrapper

Add the following to you your ~/.bash_profile

# python2 alias for osx builtin python
alias python2='/usr/bin/python'

# python homebrew setup
export PATH=/usr/local/opt/python/libexec/bin:$PATH
export PATH=/usr/local/bin:$PATH

# python virtual_env
export VIRTUALENVWRAPPER_PYTHON=/usr/local/opt/python/libexec/bin/python
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Devel
source /usr/local/bin/virtualenvwrapper.sh

For OSX Mojave 10.14

  • brew update
  • (Re)Install CLT. installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
  • brew reinstall python

Windows 10

Windows - for python2 alongside python3

  • download python 2.7: https://www.python.org/downloads/
  • go through installer, DO NOT check "Add Python PATH"
  • Manually add c:/Python27 and c:/Python27/Scripts to windows path
  • Windows search, "environment variables"
  • click "environment variables"
  • user variables, select "Path", click "edit"
  • click "new", "browse", etc
  • important: once done, go to c:/Python27
  • rename "python.exe" to "python2.exe"
  • open mingw64 console and try "which python2"

Windows - python virtualenv setup

  • tbd...

WSL

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