0

如果我用 安装最新的稳定版 1.2.7 django-haystacksudo pip install django-haystack它可以正常工作。但是在卸载它并按照主页上的建议安装最新的开发版本 2.0.0 BETA 之后:

pip install -e git+https://github.com/toastdriven/django-haystack.git@master#egg=django-haystack

尽管有以下成功消息,但似乎没有正确安装:

Obtaining django-haystack from git+https://github.com/toastdriven/django-haystack.git@master#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 install default 工作正常,但只要我得到最新的 Git 版本,我的 django 似乎看不到它。

我会错过什么?

非常感谢您的建议,

更新

抱歉,但似乎该错误仅在 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']
4

1 回答 1

1

我终于让它工作了。

正如我所说,问题pip install -e git+https://github.com/toastdriven/django-haystack.git@master#egg=django-haystack显然不起作用。

我只是将其卸载并确保将其删除。

然后我只是将源代码下载为 zip 文件,将其解压缩并

python setup.py build
sudo python setup.py install

这样它就可以保证正常工作。希望这可以帮助某人。

于 2012-08-27T10:29:57.500 回答