简述:在python2和python3共存的情况下,python2已存在scrapy或者不存在。则根据需要python3需安装scrapy,安装报错如下。。。
错误原因,通过pip install 安装scrapy是报错
Could not find a version that satisfies the requirement Twisted>=13.1.0 (from Scrapy) (from versions: )
No matching distribution found for Twisted>=13.1.0 (from Scrapy)
原因是没有安装Twisted
1、在这里需要安装twisted,可通过
wget https://twistedmatrix.com/Releases/Twisted/18.9/Twisted-18.9.0.tar.bz2
获取,然后进行解压 -xjvf
tar -jxvf Twisted-18.9.0.tar.bz2
注意在解压是可能会遇到
tar (child): lbzip2: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
的错误,这是因为你没有安装bzip2,通过
命令安装一下就好了
yum -y install bzip2
2、解压之后
cd Twisted-18.9.0
到目录下,通过python3 setup.py install 指令进行安装
附加:
如果python3 setup.py install报错,请点开链接创建一下虚拟环境:
https://blog.csdn.net/Ren_ger/article/details/89471297
4、最后直接进行scrapy安装就行了
python3 -m pip install scrapy
scrapy其他报错:
关于Python安装模块出现error: command ‘gcc’ failed with exit status 1错误的解决方法
(该方法理解为创建开发环境,此链接信息不全,搜索其他相关跟此报错有关的解决方法,提示python-devel根据你的版本,本人python2与python3共存,所以创建python3的开发环境是 yum install python3-devel)