我的virtualenv python中有zopeskel 2.21.2,它运行正常。同时,我的Plone buildout中也有相同版本的zopeskel(位于~/.buildout/eggs
)。但是,它不起作用。运行zopeskel --list
会引发以下错误:
ImportError: cannot import name BasicNamespace
来自link的建议说要取出鸡蛋。我已经删除了鸡蛋以及〜/ .buildout / cache / dist /中的缓存包,并再次运行buildout。但问题仍然存在。有趣的是,同一个buildout中的贴图脚本正在工作。
buildout.cfg中的zopeskel部分如下所示:
[zopeskel]
recipe = zc.recipe.egg
eggs =
ZopeSkel
Paste
PasteDeploy
PasteScript
zopeskel.dexterity
${instance:eggs}
我的buildout中使用的一些软件包版本:
'/home/user/.buildout/eggs/Paste-1.7.5.1-py2.6.egg',
'/home/user/.buildout/eggs/distribute-0.6.24-py2.6.egg',
'/home/user/.buildout/eggs/PasteDeploy-1.3.4-py2.6.egg',
'/home/user/.buildout/eggs/PasteScript-1.7.4.2-py2.6.egg',
完整追溯:
[user@rizal myplone.site]$ ./bin/zopeskel --list
Traceback (most recent call last):
File "./bin/zopeskel", line 346, in <module>
import zopeskel.zopeskel_script
File "/home/user/.buildout/eggs/ZopeSkel-2.21.2-py2.6.egg/zopeskel/__init__.py", line 2, in <module>
from zopeskel.basic_namespace import BasicNamespace
File "/home/user/.buildout/eggs/ZopeSkel-2.21.2-py2.6.egg/zopeskel/basic_namespace.py", line 2, in <module>
from zopeskel.vars import var, DottedVar, StringVar, BooleanVar, TextVar
File "/home/user/.buildout/eggs/ZopeSkel-2.21.2-py2.6.egg/zopeskel/vars.py", line 2, in <module>
from paste.script.templates import var as base_var
File "/home/user/.buildout/eggs/PasteScript-1.7.4.2-py2.6.egg/paste/script/templates.py", line 6, in <module>
import copydir
File "/home/user/.buildout/eggs/PasteScript-1.7.4.2-py2.6.egg/paste/script/copydir.py", line 4, in <module>
import pkg_resources
File "/home/user/.buildout/eggs/distribute-0.6.24-py2.6.egg/pkg_resources.py", line 2727, in <module>
add_activation_listener(lambda dist: dist.activate())
File "/home/user/.buildout/eggs/distribute-0.6.24-py2.6.egg/pkg_resources.py", line 700, in subscribe
callback(dist)
File "/home/user/.buildout/eggs/distribute-0.6.24-py2.6.egg/pkg_resources.py", line 2727, in <lambda>
add_activation_listener(lambda dist: dist.activate())
File "/home/user/.buildout/eggs/distribute-0.6.24-py2.6.egg/pkg_resources.py", line 2230, in activate
map(declare_namespace, self._get_metadata('namespace_packages.txt'))
File "/home/user/.buildout/eggs/distribute-0.6.24-py2.6.egg/pkg_resources.py", line 1827, in declare_namespace
_handle_ns(packageName, path_item)
File "/home/user/.buildout/eggs/distribute-0.6.24-py2.6.egg/pkg_resources.py", line 1797, in _handle_ns
loader.load_module(packageName); module.__path__ = path
File "/usr/lib/python2.6/pkgutil.py", line 238, in load_module
mod = imp.load_module(fullname, self.file, self.filename, self.etc)
File "/home/user/.buildout/eggs/ZopeSkel-2.21.2-py2.6.egg/zopeskel/__init__.py", line 2, in <module>
from zopeskel.basic_namespace import BasicNamespace
ImportError: cannot import name BasicNamespace
可能出现什么问题?
答案 0 :(得分:5)
这通常发生在本地(buildout)和全局Python安装中都安装了ZopeSkel / Paster。由于管理站点包的Python过程失败,最终会出现不兼容的组合。
解决方案: