DEV Community

0xkoji
0xkoji

Posted on

9 3

Install python 3.7, 3.6, 3.5, and 3.4 on BigSure with pyenv

This post is about installing python 3.5, 3.6, and 3.7 since my previous post only supports python 3.8 and 3.9.
Also, I have gotten some questions on installing python 3.5 and 3.6.

In addition, I really need to install them on my BigSur lol.

If you just need to install python 3.8+, please check the following

precondition

  • Installed Homebrew

install packages with brew

brew install zlib
brew install sqlite
brew install bzip2
brew install libiconv
brew install libzip
Enter fullscreen mode Exit fullscreen mode

Install python 3.4.10

$ LDFLAGS="-L$(brew --prefix zlib)/lib -L$(brew --prefix bzip2)/lib" pyenv install --patch 3.4.10 < <(curl -sSL https://github.com/python/cpython/commit/8ea6353.patch\?full_index\=1)
Enter fullscreen mode Exit fullscreen mode

Install python 3.5.7

$ LDFLAGS="-L$(brew --prefix zlib)/lib -L$(brew --prefix bzip2)/lib" pyenv install --patch 3.5.7 < <(curl -sSL https://github.com/python/cpython/commit/8ea6353.patch\?full_index\=1)
Enter fullscreen mode Exit fullscreen mode

Install python 3.6.5

$ LDFLAGS="-L$(brew --prefix zlib)/lib -L$(brew --prefix bzip2)/lib" pyenv install --patch 3.6.5 < <(curl -sSL https://github.com/python/cpython/commit/8ea6353.patch\?full_index\=1)
Enter fullscreen mode Exit fullscreen mode

I also tried to install 3.6.9 and worked well(just changed the version).

Install python 3.7.3

I tried to install 3.7.6, 3.7.7, 3.7.8, and 3.7.9, but couldn't install them. Only 3.7.3 worked with the following.

$ CFLAGS="-I$(brew --prefix openssl)/include -I$(brew --prefix bzip2)/include -I$(brew --prefix readline)/include -I$(xcrun --show-sdk-path)/usr/include" LDFLAGS="-L$(brew --prefix openssl)/lib -L$(brew --prefix readline)/lib -L$(brew --prefix zlib)/lib -L$(brew --prefix bzip2)/lib" pyenv install --patch 3.7.3 < <(curl -sSL https://github.com/python/cpython/commit/8ea6353.patch\?full_index\=1)
Enter fullscreen mode Exit fullscreen mode
$ pyenv versions
  system
  3.4.10
  3.5.7
  3.6.5
  3.7.3
  3.8.3
Enter fullscreen mode Exit fullscreen mode

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more

Top comments (3)

Collapse
 
punkrockpolly profile image
Polina Giralt •

Adding a note that this also worked for 3.6.8 Thank you!

Collapse
 
melika_adabinejad profile image
melika adabinejad •

Thank you! this worked for 3.6.8 for Macbook with M2 and Mac OS Sonoma 14.2

Collapse
 
bubuybawang profile image
bubuybawang •

just dropping by to say that this guide helped with the "BUILD FAILED (OS X 11.6 using python-build 20180424)" issues i'm having when installing 3.6.5

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay