-5

I have Python 3.10 installed on my Mac, but when I run python --version in the terminal, it says it cannot locate Python. I have also downloaded the developer tools, but it still does not recognize that I have them installed.

The problem is occurring because I am trying to run a Python file with pygame as one of the modules, but it states that I do not have pygame installed, even though I have installed it via pip install pygame and it recognizes that I have done this. I am very confused as to what is going on.

This is happening in the built-in terminal of Code and I am on a Mac.

Steps to reproduce:

Install Python 3.10 on Mac. Install the developer tools. Run python --version in the terminal. Try to run a Python file with pygame as one of the modules. See the error message that says that pygame is not installed. Expected behavior:

I would expect the terminal to be able to locate Python 3.10 and to be able to run a Python file with pygame as one of the modules.

Actual behavior:

The terminal cannot locate Python 3.10 and it gives an error message when I try to run a Python file with pygame as one of the modules.

Possible solutions:

I have tried reinstalling Python 3.10 and the developer tools, but the problem persists. I have tried adding the Pygame directory to my Python path, but the problem persists. Other information:

I am using a MacBook Pro with macOS Monterey 12.3. I am using the built-in terminal of Code. I have tried running the Python file with pygame as a module from the command line, and I get the same error message. Thank you for your help!

  • 1
    You have installed Python *how exactly*? You get what error messages exactly? You're saying that it both doesn't find Python as such, and also doesn't find the pygame module. Both of these statements can't be true at the same time, as you'd first need to find Python to then have it try to locate pygame. – deceze Aug 01 '23 at 12:43
  • There are *two* versions of Python in widespread use: python2 and python3. Because a lot of legacy software expects the `python` command to refer to python2 a lot of installs do **not** automatically symlink the `python3` command to `python`. Try running `python3 --version` and you'll probably see it. As for pygame, if you can't find your Python installation how did you install *that*? As deceze says, a lot of what you're telling us doesn't really add up. – Jared Smith Aug 01 '23 at 12:50
  • Since you used pip to install pygame, also try `pip --version`. It will tell you for which Python it installed pygame. That's probably not for the 3.10 Python version you installed. – 9769953 Aug 01 '23 at 12:50

1 Answers1

-1

Check Installation Location: First, ensure that Python 3.10 was installed correctly on your system. By default, Python 3.10 should be installed in the /usr/local/bin directory. You can verify this by opening a new terminal window and running the following command:

ls /usr/local/bin/python3.10

If Python 3.10 is installed in that location, you should see the path to the Python 3.10 executable.