Python Forum
Can't Find Python (or Something)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can't Find Python (or Something)
#1
I've been trying to use Python for several days without success. So I am seeking support.

I am running MacOS Sonoma 14.1.1 on a new MacBook. I installed 'successfully' Python 3.12.0. I had a long Python script that I have not been able to get running as every attempt, no matter what I do, results in file not found errors.

So I wrote a simple Python script titled hello_world.py in hopes I could locate and repair the situation.

Here is my code:

`
# Print the message "Hello, World!"
print("Hello, World!")
`

No matter what I do I get this result:

`
zsh: command not found: python
`

I have verified with the command python3 --version that Python exists as it returns 'Python 3.12.0'

I have verified that the PATH included usr/bin and usr/local/bin

I have tried adding a .zshrc file with paths to these directories.

I have even tried explicitly running the commands /usr/local/bin/python hello_world.py and /usr/bin/python hello_world.py

Every attempt simply returns the same or similar error indicating command not found or sometimes no such file or directory.

Three days in, I would cherish hearing from anyone who may know what I am doing incorrectly.

thanx,

ken
Reply
#2
Too little information (for example how have you tried to run the code) but this should be self explanatory:

Quote:zsh: command not found: python
I have verified with the command python3 --version that Python exists as it returns 'Python 3.12.0'

It appears that you have python3 but you get error for trying to run python.
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply
#3
(Nov-26-2023, 02:23 AM)pklind Wrote: I have verified with the command python3 --version that Python exists as it returns 'Python 3.12.0'
Then all is ok.
Python is not pre-installed on Mac automatically anymore.
Previously Mac came with a pre-installed Python 2.7 and then python command did return 2,7(now dead💀).
(Nov-26-2023, 02:23 AM)pklind Wrote: I have tried adding a .zshrc file with paths to these directories.
You can use alias in .zshrc file.
Do first which python3 the result Path:
alias python=/<your path>/python3
Then both python and python3 point to Python 3.12.

Some other way in this link like eg using pyenv .
rob101 likes this post
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020