开发者

pydev does not recognize django installation

I have python 2.6.1 installed with django 1.3 and PyDev 2.0. I am able to import django and print the version from commandline. However, when I try to create a Django project with pydev or even import django I get an error. When creating the django project, I get "Django not found." error.

I have t开发者_运维技巧ried removing and adding the pythong interpreter to rescan the site-packages. I see that django is not available in the Libraries section. I have even tried adding the folder manually and applying the setting.

Am I missing something?

Thanks


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').


I had the same problem. I even had django in my System Libs. My solution was to add the same folder to the Project > PyDev-PYTHONPATH > External Libraries:

/usr/local/lib/python2.7/dist-packages

Before that I tried to reinitiate the interpreter, but no luck. The above solution was the only one the worked for me.


I had the exact same problem - only with later versions of the different softwares: Python 3.3.2 and Django 1.5.1 under Eclipse with PyDev 2.7.5. I solved the problem differently:

I simply copied the complete Django 1.5.1 folder into the Python "Resources" folder /System/Library/Frameworks/Python.framework/Versions/3.3/Resources/Django-1.5.1 and applied the interpreter again.

This worked right away, letting me create a Django project from within the eclipse. Hope this helps.

Frank


If you have installed Django by pip as Django site mentions1, and you can find django files in /python/Lib/site-packages/django path, you do not need to configure the interpreter manually. You can remove the chosen interpreter and select Quick-Auto Config.

pydev does not recognize django installation

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜