Reputation: 97
In centOS 6.7 python2.6 is pre installed. I wanted to install python2.7 because django doesn't support python2.6.
While doing migration i am getting this issue.
What i guess in the issue is its taking python2.6. I just need to add the PythonPath in manage.py so that i can use python2.7 independently.
Note: i dont need to uninstall python2.6 because some services are using python2.6.
Any help will be apprecitaed
File "/usr/bin/django-admin", line 7, in <module>
from django.core.management import execute_from_command_line
File "/usr/lib/python2.6/site-packages/django/core/management/__init__.py", line 68
commands = {name: 'django.core' for name in find_commands(__path__[0])}
Thanks in advance
Upvotes: 0
Views: 194
Reputation: 918
You can have multiple python running on your system. No need to update the existing python version of your OS as it might corrupt some applications. First install python2.7 on your system. Follow below steps (I didnt tested it, you can find enough links to install it on your system. You can use this)
cd /opt
wget --no-check-certificate
https://www.python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz
tar xf Python-2.7.6.tar.xz
cd Python-2.7.6
./configure --prefix=/usr/local
make && make altinstall
Once done type python2.7 on your terminal and you'll see python2.7 console.
Now to run your django project on python 2.7 create a virtualenv with python 2.7 using below command
virtualenv -p /usr/bin/python2.7 <path/to/new/virtualenv/>
Refer this for virtualenv setup.
Now activate the virtualenv and type python
and you will notice the session is now using python2.7. Now you can setup your django project using that virtual environment.
Upvotes: 1
Reputation: 20569
One way of doing it (and recommended one) is to create separate virtualenv for you django project and activate it every time you're trying to use manage.py.
Second one is to replace system python with newer one. It's risky, but should work fine for that version of Cent OS.
Upvotes: 1