The scenario is, you're on the latest and greatest python version (3.7 in my case) and you need to install an earlier version (default ubuntu at this time is 3.5.2). When you try to do this through pyenv you get the following error:
Last 10 log lines:
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
clang -c -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Werror=declaration-after-statement -I. -IInclude -I./Include -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/Users/sstults/.pyenv/versions/3.5.2/include -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/Users/sstults/.pyenv/versions/3.5.2/include -DPy_BUILD_CORE -o Python/frozen.o Python/frozen.c
rm -f libpython3.5m.a
ar rc libpython3.5m.a Modules/getbuildinfo.o
/opt/local/bin/ranlib: object: libpython3.5m.a(getbuildinfo.o) malformed object (unknown load command 1)
ar: internal ranlib command failed
make: *** [libpython3.5m.a] Error 1You have to install the package manually from Python.org. But after you do that you get some crazy SSL error when you try to use pip. https://stackoverflow.com/questions/49743961/cannot-upgrade-pip-9-0-1-to-9-0-3-requirement-already-satisfied/49758204#49758204
You need to manually install pip in this new version of python.
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.pyMake sure your python command is the one you just installed (which python or which python3 and python --version)
brew install ruby