> For the complete documentation index, see [llms.txt](https://a.b.cr/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://a.b.cr/dictionary/troubleshooting/a-weird-python-command-not-found-problem.md).

# A Weird Python Command Not Found Problem

## Problem Statement

I met a weird problem with the following output:

```shell-session
$ python
pyenv: python: command not found

The `python' command exists in these Python versions:
  3.9.11

Note: See 'pyenv help global' for tips on allowing both
      python2 and python3 to be found.
```

What happened??? I just took a nap and turned my computer back on, why did *python* get lost???

## Resolution

Ok... Let me check these paths: `/usr/bin` and `/usr/local/bin` :

```shell-session
$ ls /usr/bin /usr/local/bin | grep python
python3
```

OMG! ONLY `python3` EXISTS!

At that moment, I started to recall if I did anything stupid which removed the system `python` by mistake.&#x20;

After half an hour of useless attempts, it flashed through my mind that I had just upgraded to macOS Monterey 12.3.1 before I went to sleep, and let me check the [release notes](https://developer.apple.com/documentation/macos-release-notes/macos-12_3-release-notes#Python):

> #### Python <a href="#python" id="python"></a>
>
> **Deprecations**
>
> * Python 2.7 was removed from macOS in this update. Developers should use Python 3 or an alternative language instead. (39795874)

Now the truth is out, Apple took a shot at me.

This problem can be fixed simply as I have had another python3 installed by Homebrew.

```shell-session
$ brew install python3
-- snip --
Warning: python@3.9 3.9.12 is already installed and up-to-date.
To reinstall 3.9.12, run:
  brew reinstall python@3.9
```

And now you can simply create a symbolic link to it by:

```shell
sudo ln -s /opt/homebrew/bin/python3 /usr/local/bin/python
```

Finally, try `python` again:

```shell-session
$ python
Python 3.9.12 (main, Mar 26 2022, 15:44:31)
[Clang 13.1.6 (clang-1316.0.21.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 
```

## Conclusion

Maybe I should read every release note carefully before I click *UPGRADE NOW.*

## Reference

1. [macOS Monterey 12.3 Release Notes](https://developer.apple.com/documentation/macos-release-notes/macos-12_3-release-notes#Python)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://a.b.cr/dictionary/troubleshooting/a-weird-python-command-not-found-problem.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
