Search code examples
python-3.xsyntax-errorsetup.pyfailed-installation

python installation fails with File "setup.py", line 1023, SyntaxError: invalid syntax


I am trying to install python3.8.1 on a RHEL 7 server. It is an offline installation. The python folder is untared and stored in a folder in the server. After redirecting myself into the folder where the setup.py file is located. I run

master1 Python-3.8.1]$ sudo python setup.py install-sh

  File "setup.py", line 1023
    libraries=[panel_library, *curses_libs]))
                              ^
SyntaxError: invalid syntax

I cant find a solution. Appreciate help


Solution

  • You are trying to install python with source code zipped in tgz. So, you will need to compile it and then install it.

    Once you unzip, refer readme.rst file.

    Build Instructions

    On Unix, Linux, BSD, macOS, and Cygwin::

    ./configure
    make
    make test
    sudo make install
    

    This will install Python as python3.

    I think you are using command to install packages offline using setup.py, that won't work for python fresh installation