Setup Python Development Environment on Mac OS X Yosemite

Setup Python development environment on Mac OS X Yosemite can be tricky. Assuming we got a clean Mac machine with OS X Yosemite.

Here are what we did:

Now it is recommended to use virtualenv on each Python project or at least we do. Here are the commands under the project folder, for example for Python 2.7:

$ ~/buildout.python/bin/virtualenv-2.7 --no-site-packages -p ~/buildout.python/python-2.7/bin/python .
$ source ./bin/activate
$ ./bin/easy_install -U setuptools
$ ./bin/easy_install setuptools_git
$ ./bin/easy_install setuptools_subversion

If buildout is used in the project, make sure latest that have --setuptools-version option is used. Here are the commands:

$ ./bin/python --setuptools-version=6.0.2 -v 2.2.1
$ ./bin/buildout

Change the version to any version number.

If experiencing SSLError: SSLV3_ALERT_HANDSHAKE_FAILURE or SSLError: CERTIFICATE_VERIFY_FAILED while using buildout or requests, no clear solution at the moment. Some said these two commands below do help: brew install openssl and brew link openssl --force. Both openssl version with or without Python should be the same by running python -c 'import ssl; print(ssl.OPENSSL_VERSION)' and openssl version.


Comments powered by Disqus