Upgrade xcode cli tools to the most recent (this takes a while):
$ softwareupdate --list
$ softwareupdate --install "Command Line Tools for Xcode-13.4"
Watch pyenv not be able to install anything (pyenv/issues/2143), because of what seems to be a mismatch across Python, Clang and Monterey (issue45405).
Update pyenv to pick up patched versions that work (3.10.3+, 3.9.13, 3.9.9, 3.8.13, 3.7.13).
$ brew upgrade pyenv
Go ahead and install a working patched Python for Monterey (this also takes a while):
$ pyenv install 3.10.3
Create an env (in this example for a directory called py-sandbox
):
$ pyenv virtualenv 3.10.3 py-sandbox
$ mkdir py-sandbox
$ cd py-sandbox
$ pyenv local py-sandbox
Check it's the right Python version:
$ python --version
Python 3.10.3
Install some basics:
$ pip install --upgrade pip
$ pip install jupyter
$ pip install pipenv
$ pip install poetry
$ pip install ipython
Make IPython pick up the env:
$ hash -r
Open IPython:
$ ipython
Python 3.10.3 (main, Jun 28 2022, 21:54:28) [Clang 13.1.6 (clang-1316.0.21.2.5)]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.4.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: