2012-08-26 290 views
0

如果我安装最新的稳定1.2.7 django-haystacksudo pip install django-haystack,它工作正常。但是,卸载它,并安装了最新开发版本2.0.0 BETA而不是作为建议的主网页后:ImportError:No module named haystack

pip install -e git+https://github.com/toastdriven/[email protected]#egg=django-haystack 

尽管下面的成功消息,现在看来似乎是安装不正确:

Obtaining django-haystack from git+https://github.com/toastdriven/[email protected]#egg=django-haystack 
    Cloning https://github.com/toastdriven/django-haystack.git (to master) to ./src/django-haystack 
    Running setup.py egg_info for package django-haystack 

Installing collected packages: django-haystack 
    Running setup.py develop for django-haystack 
    Checking .pth file support in /usr/local/lib/python2.7/dist-packages/ 
    /usr/bin/python -E -c pass 
    TEST PASSED: /usr/local/lib/python2.7/dist-packages/ appears to support .pth files 

    Creating /usr/local/lib/python2.7/dist-packages/django-haystack.egg-link (link to .) 
    Adding django-haystack 2.0.0-beta to easy-install.pth file 

    Installed /home/kave/projects/cb/src/django-haystack 
Successfully installed django-haystack 
Cleaning up... 

因为当我进入Django的shell环境,做一个

>>> from haystack import indexes 

Traceback (most recent call last): 
    File "<console>", line 1, in <module> 
ImportError: No module named haystack 

我按照指示,并有 INSTALLED_APPS = (... 'haystack',)在那里

我以前有这个问题,但永远不能解决它。 sudo pip安装默认工作正常,但只要我得到最新的Git版本,我的django似乎没有看到它。

我可能会错过什么?

非常感谢您的咨询,

UPDATE

道歉,但似乎在错误的Aptana Studio的3.0内只发生。在Django Shell中,我可以完成导入。我仍然眼花缭乱,因为这应该是相同的。为什么Aptana在使用sudo pip install django-haystack进行安装时可以看到这些库,但如果使用最新的Git版本,则无法看到这些库?请问那里有什么问题?

更新2

sys.path

['/home/kaveh/projects/cb', '/usr/local/lib/python2.7/dist-packages/requests-0.13.9-py2.7.egg', '/home/kaveh/projects/cb/src/django-haystack', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PIL', '/usr/lib/python2.7/dist-packages/gst-0.10', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/python2.7/dist-packages/ubuntu-sso-client', '/usr/lib/python2.7/dist-packages/ubuntuone-client', '/usr/lib/python2.7/dist-packages/ubuntuone-control-panel', '/usr/lib/python2.7/dist-packages/ubuntuone-couch', '/usr/lib/python2.7/dist-packages/ubuntuone-installer', '/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol'] 
+0

在你的shell中,当前目录是什么? sys.path的值? – nneonneo

+0

谢谢。我只是做了'print sys.path',我看到''/ home/kave/projects/cb/src/django-haystack','我看到那里存在路径。我的问题中也有完整的系统路径。 – Houman

回答

1

我终于得到它的工作。我的问题是pip install -e git+https://github.com/toastdriven/[email protected]#egg=django-haystack显然不工作。

我只是卸载它,并确保它被删除。

然后,我只是下载的源为zip文件,提取并

python setup.py build 
sudo python setup.py install 

这样就会保证合作。希望这可以帮助某人。