且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

python& Scrapy:Scrapy版本的问题

更新时间:2023-08-21 18:48:58

那时我也遇到了类似的问题,这是因为 Ubuntu 程序包弄乱了 pip 包.

I had a similar issue back then and It was because the Ubuntu package was messing with the pip package.

当我使用 pip 安装Scrapy并尝试运行它时, scrapy 说该软件包缺少某些依赖项,然后我安装了 Scrapy 使用apt-get,在那里我搞砸了软件包的版本.

When I installed Scrapy using pip and try to run it, scrapy says that the package was missing some dependencies and then I installed Scrapy using apt-get and there is where I screwed up with the package version.

我建议您从 Ubuntu Pip 中删除这两个软件包,然后仅使用pip重新安装:

I recommend you to remove both packages from Ubuntu and Pip and then reinstall only using pip:

apt-get remove --purge python-scrapy
pip uninstall scrapy

这些操作完成后,您可以使用pip重新安装,然后,如果您执行scrapy version,则应该以最新版本作为响应,对于您来说,最新版本应为 0.24.4 .

After those actions finished you can install it again using pip and then if you do scrapy version you should get as response the newest version, in your case it should be 0.24.4.

您可以在Scrapy文档中阅读以下内容:

You can read this in Scrapy Documentation:

python-scrapy是官方的debian存储库提供的另一种软件包,它已经过时了,Scrapy团队也不支持.

python-scrapy is a different package provided by official debian repositories, it’s very outdated and it isn’t supported by Scrapy team.

要在Ubuntu中安装Scrapy,他们会说:

To install Scrapy in Ubuntu they say:

  1. 将用于将Scrapy软件包签名的GPG密钥导入APT密钥环:

  1. Import the GPG key used to sign Scrapy packages into APT keyring:

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 627220E7

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 627220E7

使用以下命令创建/etc/apt/sources.list.d/scrapy.list文件 以下命令:

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

echo 'deb http://archive.scrapy.org/ubuntu scrapy main' | sudo tee /etc/apt/sources.list.d/scrapy.list

3.更新软件包列表并安装scrapy-0.24软件包:

3.Update package lists and install the scrapy-0.24 package:

sudo apt-get更新&& sudo apt-get install scrapy-0.24

sudo apt-get update && sudo apt-get install scrapy-0.24

在此处检查:在Ubuntu上Scrapy