Python
The following command will install Python 2.7 and any dependencies required (it can take a few minutes to build everything):
When finished, you should get a summary in the terminal. Running should output /usr/local/bin/python
.
It also installed (and its dependency Setuptools), which is the package manager for Python. Let’s upgrade them both:
$ pip install --upgrade setuptools
Executable scripts from Python packages you install will be put in /usr/local/share/python
, we already had this in the Env.sh
file created before. Save the file and open a new terminal to take the new $PATH
into account (everytime you open a terminal, .bash_profile
gets loaded).
Pyenv method
To upgrade pyenv in the future, use upgrade
instead of install
.
After installing, add pyenv init
to your shell to enable shims and autocompletion.
Restart your shell so the path changes take effect. You can now begin using pyenv.
$ exec $SHELL
To list the all available versions of Python, including Anaconda, Jython, pypy, and stackless, use:
$ pyenv install --list
Then install the desired versions:
The leading version takes priority.
All installed Python versions can be located in ~/.pyenv/versions
. Alternatively, you can run:
$ pyenv versions
system (set by /Users/your_account/.pyenv/version)
* 3.5.2
This shows an asterisk *
next to the currently active version.
Local application-specific Python version
The local
command will set local application-specific Python version(s) by writing the version name to a file in the current directory. This version overrides the global version. For example, to install anaconda3-4.1.1 in path/to/directory
: