ImportError:没有名为haystack的模块

时间:2012-08-26 23:39:12

标签: aptana aptana3 django-haystack

如果我使用django-haystack安装最新的稳定版1.2.7 sudo pip install django-haystack,则可以正常使用。但卸载它并安装最新的dev版本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

我按照说明操作了 <{1}}在那里

之前我遇到过这个问题,但永远无法解决。 sudo pip install默认工作正常,但只要我得到最新的Git版本,我的django似乎没有看到它。

我能错过什么?

非常感谢您的建议,

更新

道歉,但似乎错误只发生在Aptana Studio 3.0中。在Django Shell中我毕竟可以进行导入。我仍然眼花缭乱,因为这应该是一样的。为什么Aptana在使用INSTALLED_APPS = (... 'haystack',)进行安装时会看到库,但如果使用最新的Git版本则无法看到库?那可能出现什么问题?

更新2

完整sudo pip install django-haystack

sys.path

1 个答案:

答案 0 :(得分: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

这样可以保证工作正常。希望这有助于某人。