开发者

Why doesn't Pydev find Django?

I have Django installed. I also have django-admin.py in my python-2.7 folder. I can import django using 开发者_高级运维my Python shell (DreamPie). But I can't create a new Django project in Pydev. When trying to create a new Pydev Django Project (choosing python2.7 as the interpreter) I receive the following error message:

Why doesn't Pydev find Django?

I went to the link in the message and I have all the pre-requisite to getting started in Django: Django is installed and import django properly works (in the shell).


In Eclipse:

Window --> Preferences --> Interpreter - Python.

Make sure to choose Python2.7 as the interpreter.

Now, click New Folder. Browse to find the path to django (in this case: C:\Django-1.2.5\django).

Why doesn't Pydev find Django?

OK --> Apply --> OK.

That's it. You can create a new Django project.


What helped me (adjust dir and file names according your installation):

I created copy of file Django-1.3-py2.7.egg-info from C:\Python27\Lib\site-packages\ in the same folder with extender *.egg.

Then, in Eclipse dialog

Window -> Preferences -> PyDev -> Interpreter-Python

I used buton New Egg/Zip(s) in order to add this newly created file to System PYTHONPATH list.

This way Eclipse found Django.


I refer to Fabio Zadroznys answer which should work for all of you.

Probably the PYTHONPATH configured in your interpreter is not correct...

I.e.: if you have a structure with

/my/path/django
/my/path/django/init.py

you have to make sure that

/my/path

is added to the PYTHONPATH (and /my/path/django is NOT!!!)

Another thing to note is that right after installing Django, you just have to do a refresh >in your interpreter so that it's recognized (go to the interpreter preferences page, press >'apply' and choose the interpreters to be re-analyzed -- there are already plans to make >this automatic in one of the upcoming releases, but right now you have to do that manually >because the interpreter is analyzed when you configure it and 'set in stone').

LINK:
pydev does not recognize django installation


You can follow any python version. But in your case Django is not installed globally.

Requirement is you need to have Django installed in system.

For checking the django is installed or not

open CMD / terminal (Assuming that Python is already installed)

$ python

$ import django

$ django.VERSION

You can see the output like this. Here I am using Django 3.1

(3, 1, 0, 'final', 0)

Then in the Preferences --> Interpreter - Python --> Click new and add the location where python.exe or Python application resides. Make sure you are naming the Interpreter appropriately for future reference.

Then restart the eclipse and go to New --> Other --> PyDev --> PyDev Django Project

  1. Name your project
  2. Select the Interpreter that you previously created from the drop down.

The above fixes your issue.


not working for me. the attached screensnap shows that django is importable from the pydev shell, and that the path to it is in pydev's SYSTEMPATH.

Why doesn't Pydev find Django?

(since folks have mentioned virtualenv in other questions, i'll mention this is occuring within a virtualbox but i don't think that matters?)


It needs to be in the PATH or in the /usr/bin

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜