I am brand new to Python, and have been trying to get the Django framework installed on my server. I can't seem to find an answer or even a hint in the right direction anywhere online for this issue.
I have a VPS over at LiquidWeb and I am trying to install on that server. I've been following the Django installation guide over at: https://docs.djangoproject.com/en/1.4/topics/install/#installing-official-release
I am trying to install the stable release, not the development version, and have tried installing manually and via PIP - both are giving me the same error, listed below:
root@host [/]# sudo pip install Django
Downloading/unpacking Django
Downloading Django-1.4.1.tar.gz (7.7Mb): 7.7Mb downloaded
Running setup.py egg_info for package Django
Traceback (most recent call last):
File "<string>", line 14, in ?
File "/build/Django/setup.py", line 69, in ?
version = __import__('django').get_version()
File "django/__init__.py", line 15
parts = 2 if version[2] == 0 else 3
^
SyntaxError: invalid syntax
Command python setup.py egg_info failed with error code 1 in /build/Django Storing complete log in /root/.pip/pip.log
I am using Python 2.4.3 and trying to install Django 1.4.1.
Any help would be greatly appreciated, thanks in advance!
Wait, you're using Python 2.4?! Django 1.4 dropped support for 2.4. You'll have to upgrade Python to get it to work. If you're upgrading, you may as well use latest Python 2 version (2.7).
The exact cause of the error is that the setup script uses the ternary conditional operator (true_expr if cond else false_expr), which I think was introduced in Python 2.5. While you could work around it by editing the script, similar things will probably be all over the Django codebase, so you would have to backport the entire framework.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With