Installing Python 3.12.0 with asdf
I tried installing Python on my work machine last week using asdf.
The steps to install it are easy. All I had to do was add the Python plugin and run asdf install
> asdf plugin-add python # add python plugin
> asdf install python 3.12.0
It was not exactly a smooth process. I got the following error:
python-build 3.12.0 /Users/xxx/.asdf/installs/python/3.12.0
python-build: use openssl@3 from homebrew
python-build: use readline from homebrew
Downloading Python-3.12.0.tar.xz...
-> https://www.python.org/ftp/python/3.12.0/Python-3.12.0.tar.xz
Installing Python-3.12.0...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/xxx/.asdf/installs/python/3.12.0/lib/python3.12/lzma.py", line 27, in <module>
from _lzma import *
ModuleNotFoundError: No module named '_lzma'
WARNING: The Python lzma extension was not compiled. Missing the lzma lib?
Installed Python-3.12.0 to /Users/xxx/.asdf/installs/python/3.12.0
asdf: Warn: You have configured asdf to preserve downloaded files (with always_keep_download=yes or --keep-download). But
asdf: Warn: the current plugin (python) does not support that. Downloaded files will not be preserved.
After some googling, I found out that I needed to have xz
installed. Yes, that xz
. I was a bit worried but it seems like running brew install xz
will install the older version, 5.4.6
which is free from the backdoor.
Once I had xz
installed I just had to run the following commands to install Python on my work machine:
> asdf install python 3.12.0
> asdf global python 3.12.0 # will set 3.12.0 as the global default