Wonderland
  • README.md
  • Notebook
    • Crypto
      • Solana
        • Troubleshooting
          • BPF SDK path does not exist
    • Language
      • Rust
        • Reference
          • Capturing the Environment with Closures
          • Understanding &mut &mut Reference
      • C++
        • Reference
          • Code for MS rand() and srand() in VC++ 6.0
  • Textbook
    • Serials
      • A Real-Time Cryptocurrency Ticker Dashboard
        • 0 - Some Preparation
    • Frontend
      • A Simple Progress Bar
      • A React Ribbon Component
      • An Easy to Use React DnD Sortable Component
      • Sticky Header, Sticky Footer and Fluid Content
      • How To Set Same Height As Width In CSS
  • dictionary
    • Alphabet
      • MySQL
      • FFmpeg
    • Algorithm
      • Diary
        • 2022
          • 07
            • 2022-07-02
            • 2022-07-01
          • 06
            • 2022-06-30
            • 2022-06-29
            • 2022-06-28
            • 2022-06-27
            • 2022-06-26
            • 2022-06-25
            • 2022-06-24
            • 2022-06-23
            • 2022-06-22
            • 2022-06-21
            • 2022-06-20
            • 2022-06-19
            • 2022-06-18
            • 2022-06-17
            • 2022-06-16
            • 2022-06-15
            • 2022-06-14
            • 2022-06-13
            • 2022-06-12
            • 2022-06-11
            • 2022-06-10
            • 2022-06-09
            • 2022-06-08
            • 2022-06-07
            • 2022-06-06
            • 2022-06-05
            • 2022-06-04
            • 2022-06-03
            • 2022-06-02
            • 2022-06-01
          • 05
            • 2022-05-31
            • 2022-05-30
            • 2022-05-29
            • 2022-05-28
            • 2022-05-27
            • 2022-05-26
            • 2022-05-25
            • 2022-05-24
            • 2022-05-23
            • 2022-05-22
            • 2022-05-21
            • 2022-05-20
            • 2022-05-19
            • 2022-05-18
            • 2022-05-17
            • 2022-05-16
            • 2022-05-15
    • Troubleshooting
      • A Weird Python Command Not Found Problem
Powered by GitBook
On this page
  • Problem Statement
  • Resolution
  • Conclusion
  • Reference
  1. dictionary
  2. Troubleshooting

A Weird Python Command Not Found Problem

Problem Statement

I met a weird problem with the following output:

$ 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 :

$ 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.

Python

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.

$ 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:

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

Finally, try python again:

$ 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

Last updated 3 years ago

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
macOS Monterey 12.3 Release Notes