Installing Python 3.4.3 on macOS
Overview
I was given a wonderful book called “機械学習養成読本” (Machine Learning Training Reader), and I immediately started studying with it.
On page 115, Part 2, Chapter 1,
“Installing Python” didn’t go smoothly, so here are my notes.
When you run pyenv install 3.4.3, did you get an error like the following?
1 | Downloading Python-3.4.3.tgz... |
Environment
- MacOSX El Capitan 10.11.2 (15C50)
- Homebrew 0.9.5
1 | $ brew install sqlite3 |
Setting the following variables that are passed to the compiler was the key.
- CFLAGS
- LDFLAGS
- CPPFLAGS
10.3 Variables Used by Implicit Rules
One thing to be careful about is the Python that comes installed by default on the Mac.
Remove it from Python’s PATH (/usr/local/bin).
1 | $ which python |
If pip is also already installed, remove it from the PATH in the same way.
1 | $ which pip |
If you haven’t exported any other Python PATH,
the path should now point to the Python installed by pyenv.
1 | $ which python |
