0

在运行正常的 ckan 实例上,我按照本指南安装了收割机扩展:https ://github.com/ckan/ckanext-harvest

这些是我遵循的步骤:

. /usr/lib/ckan/default/bin/activate
cd /usr/lib/ckan/default/src/ckan

sudo pip install -e git+https://github.com/okfn/ckanext-harvest.git@stable#egg=ckanext-harvest

cd /usr/lib/ckan/default/src/ckan/src/ckanext-harvest
sudo pip install -r pip-requirements.txt

这是 pip-requirements.txt 的内容:

pika==0.9.8
redis==2.10.1

我继续配置插件,一切似乎都正常。我让它在http://localhost/harvest运行。然后我创建一个新的源,当我想启动收集命令时,我得到了这个错误:

$ . /usr/lib/ckan/default/bin/activate
$ cd /usr/lib/ckan/default/src/ckan/src/ckanext-harvest
$ paster --plugin=ckanext-harvest harvester gather_consumer --config=/etc/ckan/default/production.ini 

Traceback (most recent call last):
  File "/usr/lib/ckan/default/bin/paster", line 9, in <module>
    load_entry_point('PasteScript==1.7.5', 'console_scripts', 'paster')()
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/command.py", line 104, in run
    invoke(command, command_name, options, args[1:])
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/command.py", line 143, in invoke
    exit_code = runner.run(args)
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/command.py", line 238, in run
    result = self.command()
  File "/usr/lib/ckan/default/src/ckan/src/ckanext-harvest/ckanext/harvest/commands/harvester.py", line 125, in command
    from ckanext.harvest.queue import get_gather_consumer, gather_callback
  File "/usr/lib/ckan/default/src/ckan/src/ckanext-harvest/ckanext/harvest/queue.py", line 5, in <module>
    import pika
ImportError: No module named pika

我很确定 virtualenv 一定有一些非常愚蠢的东西(这里是 python 新手)

4

1 回答 1

0

这是因为您使用了sudo pip. 由于 python 的 virtualenv 是如何工作的,如果你想用来sudo安装到 virtualenv 中,你需要给出pip. 像这样的东西会起作用

sudo /usr/lib/ckan/default/bin/pip -e git+https://github.com/okfn/ckanext-harvest.git@stable#egg=ckanext-harvest
cd /usr/lib/ckan/default/src/ckanext-harvest
sudo /usr/lib/ckan/default/bin/pip install -r pip-requirements.txt
于 2015-02-26T07:02:20.243 回答