SyntaxError: invalid syntax in /django/utils/ when installing Django-4.2.4

When I install Django-4.2.4 with .tar.gz file, there is a SyntaxError: invalid syntax in /django/utils/ What’s wrong with that?

The most likely cause is that your version of Python is too old. See Django 4.2 release notes | Django documentation | Django

My python version is 3.11.4, and I tried Django-4.1.10, it raised the same error :pleading_face:

How are you trying to install it? What are the commands that you are running?

I used

sudo python install

Please do not continue to post images of commands or output. Copy/paste the text from your terminal session into the body of your post, between lines of three backtick - ` characters. This means you’ll have a line of ```, then your text (code, terminal output, etc), then another line of ```.

What is your output if you run:
sudo python -V

In the common case, this is not how you want to install Django. You generally don’t want it installed as a system-level package.

Do yourself a favor and do the install within your virtual environment. (That is not what’s going to happen when you use sudo to do the installation. It’s going to be running your system install of Python and not your virtual environment version.)

The output of sudo python -V is

Python 2.7.12

I think that’s the problem :grinning: Thank you very much!