Reputation: 389
Seems to be impossible currently with Anaconda as well as with Xcode 12. Via idle, it runs via Rosetta. There seems to be no discussion of this so either I'm quite naive or maybe this will be useful to others as well.
Python says: "As of 3.9.1, Python now fully supports building and running on macOS 11.0 (Big Sur) and on Apple Silicon Macs (based on the ARM64 architecture). A new universal build variant, universal2, is now available to natively support both ARM64 and Intel 64 in one set of executables" https://docs.python.org/3/whatsnew/3.9.html
Please help a newbie figure out how to take advantage of his recent impulse-buy.
Upvotes: 31
Views: 114548
Reputation: 1250
To avoid messing with sistem's python, I'd recomend to follow the guide from pyenv
docs.
I've just tested it on my Macbook with M2 and works ok.
Upvotes: 0
Reputation: 8709
No brew required (except drinking the joyful one at the end of the day) -
Simply download the desired universal2 version from Python Releases for macOS.
(These versions will work for both Intel and Mn (eg M1, M2) Macs.)
The downloaded file is a .pkg
file, which, as expected, you double-click to install.
The process will place some informational files and version-specific IDLE and Python Launcher apps under a version-specific folder in Applications. It will also install the appropriate python
executable in the system frameworks
folder, eg /Library/Frameworks/Python.framework/Versions/3.10/Python
Now,
You can use a virtual environment, such as the one included in PyCharm or explained in python.org's tutorial for Virtual Environments and Packages, by using the appropriate framework version.
You can use the version-specific IDLE app from within the Applications folder.
You can run scripts, without being in Terminal, by either dragging/dropping them onto the Python Launcher app's dock icon OR associating the .py
extension with the launcher app (which will allow you to simply double-click a script in Finder to run it with the launcher app).
Note that if you associate the Launcher app with files, and you have multiple python
versions installed on your Mac, you might want to customize the extension for the python
version you're using (eg, .py3.10
instead of just .py
). That way you can associate a specific version of the Launcher app with the specific version of python
you need for the script.
Upvotes: 1
Reputation: 994
I am using python3.9.4. I installed it using homebrew only.
brew install [email protected]
Also you may want to do the following to unlink and check the version number
brew unlink python3
brew link python3.9
python3 --version
Upvotes: 16
Reputation: 31
I upgraded to 3.9.4
Note: I still could not get sudo pip install mysqlclient to install.
I had add to
Upvotes: 3
Reputation: 637
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.
Upvotes: 17
Reputation: 1376
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
Upvotes: 26