Error after installing Django (supposed PATH or PYTHONPATH "error")

Posted by illuminated on Stack Overflow See other posts from Stack Overflow or by illuminated
Published on 2010-05-29T16:09:34Z Indexed on 2010/05/29 16:12 UTC
Read the original article Hit count: 406

Filed under:
|
|
|
|

Hi all,

I guess this is a PATH/PYTHONPATH error, but my attempts failed so far to make django working.

System is Ubuntu 10.04, 64bit:

mx:~/webapps$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=10.04
DISTRIB_CODENAME=lucid
DISTRIB_DESCRIPTION="Ubuntu 10.04 LTS"

Python version: 2.6.5:

@mx:~/webapps$ python -V
Python 2.6.5

When I run django-admin.py, the following happens:

mx:~/webapps$ django-admin.py
Traceback (most recent call last):
  File "/usr/local/bin/django-admin.py", line 2, in <module>
    from django.core import management
ImportError: No module named django.core

Similar when I import django in python shell:

mx:~/webapps$ python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named django
>>> quit()

More details:

mx:~/webapps$ python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"

/usr/lib/python2.6/dist-packages

Within python shell:

Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print sys.path
['', '/usr/lib/python2.6/dist-packages/django', '/usr/local/lib/python2.6/dist-packages/django/bin', '/usr/local/lib/python2.6/dist-packages/django', '/home/petra/webapps', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', '/usr/lib/python2.6/dist-packages', '/usr/lib/python2.6/dist-packages/PIL', '/usr/lib/pymodules/python2.6']

django-admin.py can be found here:

mx:~/webapps$ locate django-admin.py
~/install/sources/Django-1.2.1/build/lib.linux-i686-2.6/django/bin/django-admin.py
~/install/sources/Django-1.2.1/build/scripts-2.6/django-admin.py
~/install/sources/Django-1.2.1/django/bin/django-admin.py
/usr/local/bin/django-admin.py
/usr/local/lib/python2.6/dist-packages/django/bin/django-admin.py
/usr/local/lib/python2.6/dist-packages/django/bin/django-admin.pyc

and in the end this doesn't help:

export PYTHONPATH="/usr/lib/python2.6/dist-packages/django:$PYTHONPATH"

nor this:

export PYTHONPATH="/usr/local/lib/python2.6/dist-packages/django:$PYTHONPATH"

How to solve this !?

Thanks all in advance! :)

© Stack Overflow or respective owner

Related posts about django

Related posts about error