DEV Community

Doctorx
Doctorx

Posted on

1

Compile cpython on M2

Short instruction how to succefully complie cpython from source code on M2.

You need to sure that xcode installed or

xcode-select --install
Enter fullscreen mode Exit fullscreen mode

We need to install with brew:

brew install openssl xz zlib gdbm sqlite gcc
Enter fullscreen mode Exit fullscreen mode

Git clone cpython. My case is heads/v3.9.0b1

git clone https://github.com/python/cpython
Enter fullscreen mode Exit fullscreen mode

CD to cpython folder
Compile:

CPPFLAGS="-I$(brew --prefix zlib)/include" \ 
LDFLAGS="-L$(brew --prefix zlib)/lib" \
CC=/opt/homebrew/bin/gcc-13 \ 
arch -x86_64 \ 
./configure --with-openssl=$(brew --prefix openssl) \
--with-pydebug
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

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