One of the problems with os X python default software, despite the usage of pip, is the versions are mostly outdated. An the install through homebrew does not help at all. For example, in python 2.7.X the most updated panda’s package I could install was 0.16.x, which lack of easy plot features. In Debian/Ubuntu, it exists the NeuroDebian repository, and it is extremely useful. However it doesn’t work with os X.
The solution is installing python through anaconda. It offers the oportunity to install 2.7 version or 3.5. In any case, the default version will be the one we choose, but you can set the other by default in a terminal with a simple step. First, we download and install anaconda with the preferred flavour.
This will install the molt updated packages and set anaconda’s python install by default. And for using the different version of python (the one we have still not installed), we have to set what it’s called an environment, where the default python location will be the newer (or older version).
Having installed the 2.7 package, in order to be able to install and use python 3.5 we have to write:
$ conda create -n python3 python=3.5 anaconda
And if we want to execute the enviroment,
$ source activate python3
And it can be seen if it works because in front of the user appears the name of the environment:
(python3) Mac:~ user$
You can check the version of python with:
$python --version Python 3.5.2 :: Anaconda 4.1.1 (x86_64)
Finally, to deactivate it, type:
$ source deactivate
More info in anaconda’s doc.
Sometimes some python packages are not included in the conda manager, and installing it with simply pip does not work correctly. To do it properly, you have to execute the package from the environment
$ ~/anaconda/envs/python3/bin/pip install package_name
Of course, you can force the usage of an environment by default setting the path in
Photo from Kevin Chen