Last active
December 23, 2021 22:42
-
-
Save igorvoltaic/1bde4bdb92640923a3a743960694b6d4 to your computer and use it in GitHub Desktop.
Step-by-step Python 3.6.x installation process on Apple Macbook M1 with Mac OS X Big Sur
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 0. [OPTIONAL] In case: `Error: Failed to link all completions, docs and manpages: Permission denied @ rb_file_s_symlink` | |
sudo chown -R $(whoami) /usr/local/share/zsh | |
# 1. Install x86_64 Homebrew version: | |
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" | |
# 2. In case `brew --prefix` is not `/usr/local` run this (for zsh) and restart the terminal: | |
echo 'export PATH="/usr/local/bin/:/usr/local/sbin:$PATH"' >> ~/.zshrc | |
# 3. Install `pyenv`, `bzip`, `zlib`, `xz`: | |
arch -x86_64 brew install pyenv bzip2 zlib xz | |
# 4. [OPTIONAL] In case: `zipimport.ZipImportError: can't decompress data; zlib not available` | |
arch -x86_64 brew uninstall zlib && arch -x86_64 brew install zlib | |
# 5. Restart the terminal app or the Mac itself in case `echo $(brew --prefix zlib)` does not return `/usr/local/opt/zlib` | |
# 6. Here go dragons: | |
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" \ | |
arch -x86_64 pyenv install --patch 3.6.12 < <(curl -sSL https://github.com/python/cpython/commit/8ea6353.patch\?full_index\=1) |
Note if brew is not in
/usr/local
this will cause installation failures on step 2
Thanks! added step for that
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note if brew is not in
/usr/local
this will cause installation failures on step 2