Python(Scrapy)与“import load_entry_point"的不可预测的错误; [英] Python(Scrapy) unpredictable mistake with "import load_entry_point"
问题描述
我有这样的问题,我没有用 Python 或 Scrapy 做任何事情,但是当我今天启动我的电脑时,出现了这样的错误.我找到了许多不同的帖子并尝试了一些技巧和建议,不幸的是,它们无法正常工作,我担心不会破坏其他东西.
回溯(最近一次调用最后一次):文件/usr/bin/scrapy",第 5 行,在 <module> 中从 pkg_resources 导入 load_entry_point文件/usr/lib/python2.7/dist-packages/pkg_resources.py",第2749行,在<module>working_set = WorkingSet._build_master()文件/usr/lib/python2.7/dist-packages/pkg_resources.py",第 444 行,在 _build_masterws.require(__requires__)文件/usr/lib/python2.7/dist-packages/pkg_resources.py",第725行,需要需要 = self.resolve(parse_requirements(requirements))文件/usr/lib/python2.7/dist-packages/pkg_resources.py",第628行,解析提高 DistributionNotFound(req)pkg_resources.DistributionNotFound:服务身份
因此,也许有人有同样的错误.如果是,请告诉我您是如何解决的.
更新:我尝试了很多东西,直接搜索没有实际结果,只有 Python &Scrapy:Scrapy 版本问题 很有帮助,我已经删除了 Scrapy 并重新安装了它.魔法,但它有效.
当时我遇到了类似的问题,这是因为 Ubuntu 包与 pip 包搞混了.
我建议您从 Ubuntu 和 Pip 中删除这两个软件包,然后重新安装.
首先通过以下命令从ubuntu中删除带有所有本地配置文件的scrapy:
<块引用>apt-get remove --purge python-scrapy
pip卸载scrapy
完成这些操作后,您可以使用以下命令重新安装它.现在版本应该是 0.24.4.
- 将用于签署 Scrapy 包的 GPG 密钥导入 APT 密钥环:
<块引用>
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv627220E7
- 使用以下命令创建/etc/apt/sources.list.d/scrapy.list 文件:
<块引用>
echo 'deb http://archive.scrapy.org/ubuntu scrapy main' |须藤三通/etc/apt/sources.list.d/scrapy.list
3.更新包列表并安装scrapy-0.24包:
<块引用>sudo apt-get 更新 &&sudo apt-get install scrapy-0.24
它应该可以工作:)
I have such problem, I did nothing with Python or Scrapy, but when I started today my computer I got such error. I have found many different posts and tried some tips and advices, unfortunately, they are do not work properly and I worry not to break something else.
Traceback (most recent call last):
File "/usr/bin/scrapy", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2749, in <module>
working_set = WorkingSet._build_master()
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 444, in _build_master
ws.require(__requires__)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 725, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 628, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: service-identity
Therefore, maybe someone had the same error. If yes, please, let me know how you solved it.
UPDATE: I have tried many things and direct search was without real results, only Python & Scrapy: Issue with Scrapy version was helpful, I have deleted Scrapy and installed it again. Magic, but it works.
I had a similar issue back then and It was because the Ubuntu package was messing with the pip package.
I recommend you to remove both packages from Ubuntu and Pip and then reinstall.
First remove scrapy with all local config file from ubuntu by following command :
apt-get remove --purge python-scrapy
pip uninstall scrapy
After these actions finished you can reinstall it using following commands.Now version should be 0.24.4.
- Import the GPG key used to sign Scrapy packages into APT keyring:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 627220E7
- Create /etc/apt/sources.list.d/scrapy.list file using the following command:
echo 'deb http://archive.scrapy.org/ubuntu scrapy main' | sudo tee /etc/apt/sources.list.d/scrapy.list
3.Update package lists and install the scrapy-0.24 package:
sudo apt-get update && sudo apt-get install scrapy-0.24
It should work :)
这篇关于Python(Scrapy)与“import load_entry_point"的不可预测的错误;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!