DEV Community

Doctorx
Doctorx

Posted on

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

Oldest comments (0)