1

I recently updated python on my mac and since then, whenever I open terminal there's the following error shown:

File "/opt/homebrew/share/man/man1/python3.1", line 1
  .TH PYTHON "1"
  ^
SyntaxError: invalid syntax

Any idea how to resolve this issue?

rv.kvetch
  • 9,940
  • 3
  • 24
  • 53
m.sho
  • 11
  • 3
  • 1
    I think you need to change your Python PATH variable to point to the right directory of where your Python is installed – asultan904 Oct 03 '22 at 03:18
  • How do I do that? – m.sho Oct 03 '22 at 20:10
  • 1
    Execute `sudo nano /etc/paths` A list of directories that are currently a part of the PATH variable will appear. Enter the path of the Python install directory at the end of this list. Press control + X to quit and then Y to save the changes Execute `python3 --version` to see the PATH Source: https://www.educative.io/answers/how-to-add-python-to-the-path-variable-in-mac – asultan904 Oct 09 '22 at 18:28

1 Answers1

0

Try reinstalling:
visit https://www.python.org/downloads/ on your Mac;
It detects your operating system automatically and shows a big button for downloading the latest version of Python installer on your Mac. Install (I recomend the latest python3.10, not python3.1) python, pip is included and useful for managing packages on the command line.

Open terminal and type:

$python3

into terminal, NOT:

$python

Hope this helps.

  • Thanks, I did so and when I type python3 --version, it says python 3.10.7 but am still getting the same error when I open terminal. Should I maybe change anything in .zsh file or something? – m.sho Oct 03 '22 at 15:26