4

根据http://docs.ckan.org/en/latest/maintaining/installing/install-from-source.html在 OSX 10.9 上本地安装 CKAN 。

我已经创建并激活了 python virtualenv,现在需要创建一个 CKAN 配置文件:

$ paster make-config ckan /etc/ckan/default/development.ini

输出如下(最后一行的 ImportError ):

Distribution already installed:
      ckan 2.2 from ~/ckan/lib/default/src/ckan
    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/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/lib/python2.7/site-packages/paste/script/command.py", line 143, in invoke
        exit_code = runner.run(args)
      File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/script/appinstall.py", line 68, in run
        return super(AbstractInstallCommand, self).run(new_args)
      File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/script/command.py", line 238, in run
        result = self.command()
      File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/script/appinstall.py", line 295, in command
        self.distro, self.options.ep_group, self.options.ep_name)
      File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/script/appinstall.py", line 234, in get_installer
        'paste.app_install', ep_name)
      File "/usr/lib/ckan/default/lib/python2.7/site-packages/pkg_resources.py", line 2302, in load_entry_point
        return ep.load()
      File "/usr/lib/ckan/default/lib/python2.7/site-packages/pkg_resources.py", line 2029, in load
        entry = __import__(self.module_name, globals(),globals(), ['__name__'])
      File "~/ckan/lib/default/src/ckan/ckan/config/install.py", line 3, in <module>
        from pylons.util import PylonsInstaller
    ImportError: No module named pylons.util

我不确定如何进行,有什么想法吗?

4

2 回答 2

10

ImportError: No module named pylons.util看起来 Python 找不到 Pylons 包,这是 CKAN 依赖的 Python 包之一。想到了两种可能:

  1. 在运行 paste 命令之前,您是否激活了 CKAN virtualenv?~/ckan/default/bin/activate.

  2. 您是否已将 CKAN 依赖的 Python 包安装到您的 virtualenv 中?使用 virtualenv 激活运行pip install -r ~/ckan/default/src/ckan/requirements.txt

如果您激活 CKAN 虚拟环境然后运行pip freeze | grep pylons,这应该会告诉您是否在 virtualenv 中安装了 pylons。

Distribution already installed:终端输出顶部的 很奇怪。

于 2014-02-23T11:06:23.100 回答
2

我有同样的错误和稍微不同的解决方案:

  1. 使用后才出现错误sudo,所以我退出了它(sudo -k
  2. 然后我收到以下错误:IOError: [Errno 13] Permission denied: '/etc/ckan/default/development.ini'
  3. 经过大量挖掘,我终于发现虽然 /etc/ckan 具有正确的权限,但它实际上是一个符号链接,~/ckan/etc并且该文件夹没有正确的权限
  4. 我跑了sudo chown -R `whoami` ~/ckan/etc,跟了上去paster make-config ckan /etc/ckan/default/development.ini
于 2014-08-06T09:48:48.250 回答