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)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay