Appendix B. Install Python 3
Most of the examples in this book were written and tested with Python 3.7, the most recent stable version at the time of writing. The What’s New in Python page presents what was added in each version. There are many sources of Python and many ways to install a new version. In this appendix, I describe a few of these ways:
A standard installation downloads Python from python.org, and adds the helper programs
If your work is heavily scientific, you may prefer to get Python bundled with many scientific packages from Anaconda and use its package installer
Windows doesn’t have Python at all, and macOS, Linux, and Unix tend to have old versions. Until they catch up, you may need to install Python 3 yourself.
Check Your Python Version
In a terminal or terminal window, type
$ python -V Python 3.7.2
Depending on your operating system, if you don’t have Python or the operating system can’t find it, you’ll get some error message like command not found.
If you do have Python and it’s version 2, you may want to install Python 3—either system wide, or just for yourself in a virtualenv (see “Use virtualenv”, or “Install virtualenv”). In this appendix, I show how to install Python 3 system wide.
Install Standard Python
Go to the official Python download page with your web browser. It tries to guess your operating system and present the appropriate choices, but if it guesses wrong, you can use these: