This week was not only the release of macOS Monterey, but it was also new Mac Book Pro week for a lot of people, including myself. Given that it was alot of effot to install Python on macOS Big Sur I was a little worried that it would take the same amount of effort.
As I was starting a with a clean macOS Monterey installation and had already installed Homebew I just needed to run the following command to install pyenv:
``` terminfobrew install pyenvOnce installed, I ran the following to download and compile Python 3.10.0:
```bash frame="terminal" title="Install Python 3.10.0 using pyenv"``` terminfopyenv install 3.10.0pyenv global 3.10.0pyenv versionThe last command should return something similar to the following output:
```bash frame="terminal" title="Output of the command"$ pyenv version3.10.0 (set by /Users/russ.mckendrick/.pyenv/version)Now that Python is installed and we have set version 3.10.0 to the default Python install used by pyenv, we need to run the following command to ensure that our preferred version is used whenever we open a new terminal session.
``` terminfoecho -e $'if command -v pyenv 1>/dev/null 2>&1; then\\n export PYENV_ROOT="$HOME/.pyenv"\\n export PATH="$PYENV_ROOT/bin:$PATH"\\n eval "$(pyenv init --path)"\\n eval "$(pyenv init -)"\\nfi' >> ~/.zshrcOpen a new shell and run:
```bash frame="terminal" title="Check the python version"``` terminfopython --versionwhich python```bash frame="terminal" title="Output of the command"$ python --versionPython 3.10.0$ which python/Users/russ.mckendrick/.pyenv/shims/pythonThe final step is to make sure that pip is up-to-date, to do this run:
``` terminfopip install --upgrade pip```bash frame="terminal" title="Install Ansible"``` terminfopip install --user ansibleansible --versionAs you can see from the output below, Ansible was isntalled and using the correct version of Python:
```bash frame="terminal" title="Output of the command"$ ansible --versionansible [core 2.11.6] config file = None configured module search path = ['/Users/russ.mckendrick/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /Users/russ.mckendrick/.local/lib/python3.10/site-packages/ansible ansible collection location = /Users/russ.mckendrick/.ansible/collections:/usr/share/ansible/collections executable location = /Users/russ.mckendrick/.local/bin/ansible python version = 3.10.0 (default, Oct 26 2021, 20:43:52) [Clang 13.0.0 (clang-1300.0.29.3)] jinja version = 3.0.2 libyaml = TrueThis was a massive improvement on last years experience as it was far from smooth on day one, so props to pyenv and Homebrew teams 👍



