11
Aug 2017
On Computer Technology
NOTE: This post is pretty much opinion based on my own experience. Also take note of the date it was written because things might have changed since then. Your mileage may vary.
The best way to install python on Mac OS X is using pyenv. Why do I say so?
To me, using a sandbox environment like virtualenv or conda is absolutely essential for pretty much any project that makes use of 3rd party libraries because I do not want to install any 3rd party library globally if possible. I am more familiar with virtualenv so most of the time it is my choice.
pyenv install -l
Suppose you want to install Python 3.5.1 . Run:
pyenv install 3.5.1
myproject
you want to create a virtualenv for. This project happens to use Python 3.5.1 . To create this virtualenv, we run:pyenv virtualenv 3.5.1 myproject
Now if you run pyenv versions
, you should see something like the following:
* system (set by /home/tom/.pyenv/version)
2.7.11
3.5.1
3.5.1/envs/myproject
myproject
So we see that the virtualenv myproject
is created successfully.
myproject
virtualenv, we have to activate it usingpyenv activate myproject
You should see a (myproject)
prefix in your shell’s prompt.
pip install redis==2.10.5
pip install -r requirements.txt
pyenv deactivate
Disclaimer: Opinions expressed on this blog are solely my own and do not express the views or opinions of my employer(s), past or present.