I could install 2.7.18 on M1.
brew install pyenv
pyenv install 2.7.18
Set the python version.
pyenv global 2.7.18
Export PATH if necessary.
export PATH="$(pyenv root)/shims:${PATH}"
Add if necessary.:
echo 'PATH=$(pyenv root)/shims:$PATH' >> ~/.zshrc
Answer from Isanka Wijerathne on Stack OverflowI could install 2.7.18 on M1.
brew install pyenv
pyenv install 2.7.18
Set the python version.
pyenv global 2.7.18
Export PATH if necessary.
export PATH="$(pyenv root)/shims:${PATH}"
Add if necessary.:
echo 'PATH=$(pyenv root)/shims:$PATH' >> ~/.zshrc
Sometimes you will get some errors like missing something if you are using rosetta then run:
arch -arm64 pyenv install 2.7.18
You can now install python 3.9.1 through multiple pathways now but the most comprehensive build environment for the full data-science suite for python at the moment (Feb 2021) on M1 ARM architecture is via miniforge.
e.g.
brew install --cask miniforge
conda init zsh
conda activate
conda install numpy scipy scikit-learn
You can now install Python 3.9.4 natively on Mac M1 (Apple Silicon). I'm using pyenv to install Python 3.7, 3.8 and 3.9 all native ARM. For example, to install 3.9.4:
$ pyenv install 3.9.4
python-build: use [email protected] from homebrew
python-build: use readline from homebrew
Downloading Python-3.9.4.tar.xz...
-> https://www.python.org/ftp/python/3.9.4/Python-3.9.4.tar.xz
Installing Python-3.9.4...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
Installed Python-3.9.4 to /Users/squademy/.pyenv/versions/3.9.4
For a complete guide on install pyenv and multiple Python version, you might read this article: https://squademy.medium.com/install-python-on-macos-11-m1-apple-silicon-using-pyenv-12e0729427a9.
Few months back i installed python3 to learn coding, but after some time uninstalled the python3 by following steps given on the internet. Now when i write python --version, to check python 2 version, it shows :command not found which should be always present in the system. How do i get back python2 in system. If i install python3, will python2 also be automatically installed?
But i have not found any problems in my system yet due to python2, should i worry for future, or forget about it?
How are you installing python and creating your virtual environments so they work well on Mac M1 chips? I have an iMac and a Macbook Pro, and I'm struggling to install and run various packages to include black, psycopg2 and pdftotext. I eventually figure out, but then I start a new project and run into problems again. My current steps are:
-
Download latest version of python from the python.org website (https://www.python.org/downloads/release/python-3913/)
-
Create virtual environment using PyCharm, selecting the python install as the interpreter. example: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3
-
Open activated virtual environment in PyCharm and install dependencies with pip install -r requirements.txt
I've heard some people install python with brew, then use that to create virtual environments. Is that better? Anybody else having these issues?