Python:导入错误:没有名为 pkg_resources 的模块

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22148144/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 00:22:02  来源:igfitidea点击:

Python: ImportError: No module named pkg_resources

pythonpippelican

提问by hack4m

In order to run Pelican, I installed python2.7 and modified first line of file /usr/bin/pelican-quickstart

为了运行 Pelican,我安装了 python2.7 并修改了文件 /usr/bin/pelican-quickstart 的第一行

from:

从:

#!/usr/bin/python

to

#!/usr/bin/env python

when I type pelican-quickstart an error occured:

当我输入 pelican-quickstart 时出现错误:

Traceback (most recent call last):
  File "/usr/bin/pelican-quickstart", line 5, in <module>
    from pkg_resources import load_entry_point
ImportError: No module named pkg_resources

I found "pkg_resources" is in this directory:

我发现“pkg_resources”在这个目录中:

/usr/lib/python2.6/site-package/

I'm wondering if I have to install some packages after python2.7 is installed? or, how can I solve this problem.

我想知道安装python2.7后是否需要安装一些包?或者,我该如何解决这个问题。

回答by Leonardo

The problem must be an issue with your setup tools, try the following:

问题一定是您的设置工具有问题,请尝试以下操作:

pip install --upgrade setuptools
pip install --upgrade distribute

If this solution doesn't work, you can check the following answer

如果此解决方案不起作用,您可以查看以下答案

回答by BarryPye

You said

你说

/usr/lib/python2.6/site-package/

but should be

但应该是

/usr/lib/python2.6/site-packages/