CARVIEW |
Installing Python on macOS with the official Python installer
I usually use Homebrew on macOS, but I decided to try using the official Python installer based on this Twitter conversation.
My big fear was that it would add Yet Another Python to my system in a way that made the XKCD 1987 situation even worse!
I downloaded the installer using the prompt on the Python.org homepage (in the "Downloads" menu):
After running the installer and accepting the default options, a Python 3.10 folder was added to my /Applications
folder:
More importantly though, running python3
in my terminal now runs the version of Python that was installed by the installer - which lives in /Library/Frameworks/Python.framework/
:
~ % which python3
/Library/Frameworks/Python.framework/Versions/3.10/bin/python3
~ % python3
Python 3.10.2 (v3.10.2:a58ebcc701, Jan 13 2022, 14:50:16) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
I was confused as to how it had added itself to my path - a tip from Ned Deily (a Python release manager) helped me figure that out:
~ % grep -d skip '3.10' ~/.*
/Users/simon/.zprofile:# Setting PATH for Python 3.10
/Users/simon/.zprofile:PATH="/Library/Frameworks/Python.framework/Versions/3.10/bin:${PATH}"
So the installer added a line to my .zprofile
file adding the bin
directory for that release to my path.
Running python3.10
is the most specific way to execute that version of Python. I can install new command-line tools into that bin
directory like so:
% python3.10 -m pip install google-drive-to-sqlite
Collecting google-drive-to-sqlite
Downloading google_drive_to_sqlite-0.4-py3-none-any.whl (20 kB)
...
% google-drive-to-sqlite --version
google-drive-to-sqlite, version 0.4
% which google-drive-to-sqlite
/Library/Frameworks/Python.framework/Versions/3.10/bin/google-drive-to-sqlite
Related
- python macOS Catalina sort-of includes Python 3 - 2020-04-21
- sqlite Loading SQLite extensions in Python on macOS - 2023-01-07
- sqlite Using pysqlite3 on macOS - 2021-07-10
- selenium Installing Selenium for Python on macOS with ChromeDriver - 2020-10-02
- electron Bundling Python inside an Electron app - 2021-09-08
- python Using C_INCLUDE_PATH to install Python packages - 2021-12-09
- sqlite Building a specific version of SQLite with pysqlite on macOS/Linux - 2021-08-14
- sqlite Compile and run a new SQLite version with the existing sqlite3 Python library on macOS - 2023-08-22
- python Quickly testing code in a different Python version using pyenv - 2023-07-10
- python Running PyPy on macOS using Homebrew - 2022-09-14
Created 2022-02-28T12:33:46-08:00, updated 2022-02-28T12:42:11-08:00 · History · Edit