我正在尝试使用外部Ckan library来完成我的第一个python程序。我添加了库,它似乎正在工作,因为命令import ckanap
并没有给我任何错误。但是当我尝试运行程序时,我收到此错误
pkg_resources.DistributionNotFound:ckanapi
完整的错误消息(如果需要)是这个
Finding files... done.
Traceback (most recent call last):
File "/home/ilias/Programming/Eclipse/eclipse/plugins/org.python.pydev_4.1.0.201505270003/pysrc/pydev_runfiles.py", line 468, in __get_module_from_str
mod = __import__(modname)
File "/home/ilias/EclipseWorkspace/PythonFirst/root/nested/example.py", line 14, in <module>
import ckanapi
File "/home/ilias/Downloads/ckanapi-master/ckanapi/__init__.py", line 19, in <module>
from ckanapi.remoteckan import RemoteCKAN
File "/home/ilias/Downloads/ckanapi-master/ckanapi/remoteckan.py", line 11, in <module>
from ckanapi.version import __version__
File "/home/ilias/Downloads/ckanapi-master/ckanapi/version.py", line 3, in <module>
__version__ = pkg_resources.require("ckanapi")[0].version
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 725, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 628, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: ckanapi
ERROR: Module: example could not be imported (file: /home/ilias/EclipseWorkspace/PythonFirst/root/nested/example.py).
Importing test modules ... done.
----------------------------------------------------------------------
Ran 0 tests in 0.000s
OK
我在互联网上搜索过它,但错误并没有多大帮助,更不用说我是python的新手了。
顺便说一句,即使没有任何命令,我也会收到此错误,只需使用import语句
修改
输出命令python -c "import sys ; print( '\n'.join(sorted(sys.path)))"
/usr/lib/pymodules/python2.7
/usr/lib/python2.7
/usr/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages/PILcompat
/usr/lib/python2.7/dist-packages/gtk-2.0
/usr/lib/python2.7/dist-packages/ubuntu-sso-client
/usr/lib/python2.7/lib-dynload
/usr/lib/python2.7/lib-old
/usr/lib/python2.7/lib-tk
/usr/lib/python2.7/plat-x86_64-linux-gnu
/usr/local/lib/python2.7/dist-packages
答案 0 :(得分:1)
我认为这是ckanapi的安装问题......
它似乎有很多依赖项:https://github.com/ckan/ckanapi/blob/master/requirements.txt
你是如何安装它的?你试过pip install ckanapi吗?