Last active
February 8, 2017 14:09
-
-
Save birkin/2476406073fa281dc55e641e29a852f4 to your computer and use it in GitHub Desktop.
install python3 in virtual-env on macOS 10.12.1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ###### | |
| ## - the problem: on macOS 10.12.1, trying to install a virtual-env specifying python 3 does not work | |
| ## - cause of problem seems to be an old version of `virtualenv` | |
| ## - this is a work-around... | |
| ###### | |
| ## if you need to install python 3... | |
| ## ensure you can run brew doctor with no errors/warnings | |
| $ brew doctor | |
| Your system is ready to brew. | |
| $ brew install python3 | |
| ## lots of output | |
| $ which python3 | |
| /usr/local/bin/python3 | |
| ## my old `virtualenv` seems to be the problem | |
| ## don't remember how I originally installed `virtualenv`, | |
| ## but this is what I've been using successfully for a _long_ time with python 2: | |
| $ which virtualenv | |
| /usr/local/bin/virtualenv | |
| $ virtualenv --version | |
| 1.11.2 | |
| ## I could `sudo pip install --upgrade virtualenv`, but I try never to sudo my system for installs | |
| ## so, the work-around (though really, i need to look into a non-sudo way of updating this `virtualenv`)... | |
| $ virtualenv --python=/usr/bin/python2.7 --prompt=[env_py2] --no-site-packages /path/to/stuff/env_py2 | |
| $ source ./env_py2/bin/activate | |
| [env_py2] $ | |
| [env_py2] $ pip install --upgrade pip | |
| ## output | |
| [env_py2] $ pip install virtualenv | |
| ## output | |
| [env_py2] $ which virtualenv | |
| /path/to/stuff/env_py2/bin/virtualenv | |
| [env_py2] $ virtualenv --version | |
| 15.1.0 | |
| ## big difference! | |
| ## using the newer local `virtualenv`, _now_ the install of a virtual-env with python 3 will work | |
| [env_py2] $ virtualenv --python=/usr/local/bin/python3 --prompt=[env_py3] --no-site-packages /path/to/stuff/env_py3 | |
| Running virtualenv with interpreter /usr/local/bin/python3 | |
| ... | |
| Installing setuptools, pip, wheel...done. | |
| ## yay! | |
| [env_py2] $ deactivate | |
| $ | |
| $ source ./env_py3/bin/activate | |
| [env_py3] $ | |
| [env_py3] $ python | |
| Python 3.6.0 (default, Dec 24 2016, 08:01:42) | |
| [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin | |
| Type "help", "copyright", "credits" or "license" for more information. | |
| >>> | |
| ## nice! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment