python2.7 之centos7 安装 pip, Scrapy

简介: 一、确定python版本在2.7及以上 强烈建议升级python2.7后再安装pip与setuptools,如果不这样操作会出现很多莫明的问题,让你酸爽到天明!!  如果你是升级到python2.7,更大的可能性是全部通过python setup.py 编译安装,所需要的包含但不限于这些包   lxml,zope.interfac

一、确定python版本在2.7及以上

强烈建议升级python2.7后再安装pip与setuptools,如果不这样操作会出现很多莫明的问题,让你酸爽到天明!!

 如果你是升级到python2.7,更大的可能性是全部通过python setup.py 编译安装,所需要的包含但不限于这些包

 
lxml,zope.interface,Twisted,characteristic,pyasn1-modules,service-identity,Scrapy

  PS:我一开始就是编译安装的,其中最多的问题是:

 
error: command  'gcc'  failed with  exit  status 1

   后来我发现,如果有这样的提示不是缺少devel包就是少某一个lib库文件;最令我哭笑不得是安装Scrapy 提示成功,但无法创建项目,测试样例都跑不了,最终我果断的换centos7了!

 

###################以下内容都是Centos 7上的操作,升级到python2.7的同学请绕行##############

二、确定安装了yum的epel最新库


三、如果系统中安装有audit这个包请先移除,它会影响到Scrapy的安装

 
#yum remove audit

四、安装Scarpy 所需要的开发包

 
#yum install -y python-devel gcc libffi-devel openssl-devel libxslt-devel libxml2-devel

五、安装pip与setuptools

#yum install python-pip -y
#pip install  setuptools
#pip install setuptools --upgrade

六、安装Scrapy

# pip install Scrapy
Collecting Scrapy
   Using cached Scrapy-1.0.3-py2-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): cssselect>=0.9  in  /usr/lib/python2 .7 /site-packages  (from Scrapy)
Requirement already satisfied (use --upgrade to upgrade): queuelib  in  /usr/lib/python2 .7 /site-packages  (from Scrapy)
Requirement already satisfied (use --upgrade to upgrade): pyOpenSSL  in  /usr/lib/python2 .7 /site-packages  (from Scrapy)
Requirement already satisfied (use --upgrade to upgrade): w3lib>=1.8.0  in  /usr/lib/python2 .7 /site-packages  (from Scrapy)
Collecting lxml (from Scrapy)
   Using cached lxml-3.4.4. tar .gz
Collecting Twisted>=10.0.0 (from Scrapy)
   Using cached Twisted-15.4.0. tar .bz2
Requirement already satisfied (use --upgrade to upgrade): six>=1.5.2  in  /usr/lib/python2 .7 /site-packages  (from Scrapy)
Collecting service-identity (from Scrapy)
   Using cached service_identity-14.0.0-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): cryptography>=0.7  in  /usr/lib64/python2 .7 /site-packages  (from pyOpenSSL->Scrapy)
Collecting zope.interface>=3.6.0 (from Twisted>=10.0.0->Scrapy)
   Using cached zope.interface-4.1.3. tar .gz
Collecting characteristic>=14.0.0 (from service-identity->Scrapy)
   Using cached characteristic-14.3.0-py2.py3-none-any.whl
Collecting pyasn1-modules (from service-identity->Scrapy)
   Using cached pyasn1_modules-0.0.8-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): pyasn1  in  /usr/lib/python2 .7 /site-packages  (from service-identity->Scrapy)
Requirement already satisfied (use --upgrade to upgrade): idna>=2.0  in  /usr/lib/python2 .7 /site-packages  (from cryptography>=0.7->pyOpenSSL->Scrapy)
Requirement already satisfied (use --upgrade to upgrade): setuptools  in  /usr/lib/python2 .7 /site-packages  (from cryptography>=0.7->pyOpenSSL->Scrapy)
Requirement already satisfied (use --upgrade to upgrade): enum34  in  /usr/lib/python2 .7 /site-packages  (from cryptography>=0.7->pyOpenSSL->Scrapy)
Requirement already satisfied (use --upgrade to upgrade): ipaddress  in  /usr/lib/python2 .7 /site-packages  (from cryptography>=0.7->pyOpenSSL->Scrapy)
Requirement already satisfied (use --upgrade to upgrade): cffi>=1.1.0  in  /usr/lib64/python2 .7 /site-packages  (from cryptography>=0.7->pyOpenSSL->Scrapy)
Requirement already satisfied (use --upgrade to upgrade): pycparser  in  /usr/lib/python2 .7 /site-packages  (from cffi>=1.1.0->cryptography>=0.7->pyOpenSSL->Scrapy)
Installing collected packages: lxml, zope.interface, Twisted, characteristic, pyasn1-modules, service-identity, Scrapy
   Running setup.py  install  for  lxml
   Running setup.py  install  for  zope.interface
   Running setup.py  install  for  Twisted
Successfully installed Scrapy-1.0.3 Twisted-15.4.0 characteristic-14.3.0 lxml-3.4.4 pyasn1-modules-0.0.8 service-identity-14.0.0 zope.interface-4.1.3

七、创建项目

 
[root@localhost workspace] # scrapy startproject tutorial
2015-10-15 21:54:24 [scrapy] INFO: Scrapy 1.0.3 started (bot: scrapybot)
2015-10-15 21:54:24 [scrapy] INFO: Optional features available: ssl, http11
2015-10-15 21:54:24 [scrapy] INFO: Overridden settings: {}
New Scrapy project  'tutorial'  created  in :
     /workspace/tutorial
 
You can start your first spider with:
     cd  tutorial
     scrapy genspider example example.com

八、目录结构

 
[root@localhost workspace] # tree
.
└── tutorial
     ├── scrapy.cfg
     └── tutorial
         ├── __init__.py
         ├── items.py
         ├── pipelines.py
         ├── settings.py
         └── spiders
             └── __init__.py
 
3 directories, 6 files
目录
相关文章
|
1月前
|
存储 Ubuntu Linux
VMware-安装CentOS系统教程及安装包
虚拟机相当于是一个独立于你电脑的环境,在这个环境上面,你可以安装Linux、Windows、Ubuntu等各个类型各个版本的系统,在这个系统里面你不用担心有病读等,不用担心文件误删导致系统崩溃。 虚拟机也和正常的电脑系统是一样的,也可以开关机,不用的时候,你关机就可以了,也不会占用你的系统资源,使用起来还是比较方便 这里也有已经做好的CentOS 7系统,下载下来解压后直接用VMware打开就可以使用
384 69
|
2月前
|
Linux 计算机视觉 C++
【解决方案】Building wheel for opencv-python:安装卡顿的原因与解决方案
当你安装OpenCV时,命令行停在Building wheel for opencv-python (PEP 517) ... -似乎卡住了。这并非程序假死,而是其编译耗时巨大。本文将揭示原因,并提供优化安装体验的实用方法。
395 88
|
1月前
|
Ubuntu Linux 索引
Centos 7、Debian及Ubuntu系统中安装和验证tree命令的指南。
通过上述步骤,我们可以在CentOS 7、Debian和Ubuntu系统中安装并验证 `tree`命令。在命令行界面中执行安装命令,然后通过版本检查确认安装成功。这保证了在多个平台上 `tree`命令的一致性和可用性,使得用户无论在哪种Linux发行版上都能使用此工具浏览目录结构。
199 78
|
2月前
|
Linux 网络安全 Apache
针对在Centos/Linux安装Apache过程中出现的常见问题集锦
以上每个问题的解决方案应深入分析错误日志、系统消息和各种配置文件,以找到根本原因并加以解决。务必保持系统和Apache软件包更新到最新版本,以修复已知的bugs和安全漏洞。安装和管理Web服务器是一项需要细致关注和不断学习的任务。随着技术的发展,推荐定期查看官方文档和社区论坛,以保持知识的更新。
165 80
|
16天前
|
存储 关系型数据库 MySQL
在CentOS 8.x上安装Percona Xtrabackup工具备份MySQL数据步骤。
以上就是在CentOS8.x上通过Perconaxtabbackup工具对Mysql进行高效率、高可靠性、无锁定影响地实现在线快速全量及增加式数据库资料保存与恢复流程。通过以上流程可以有效地将Mysql相关资料按需求完成定期或不定期地保存与灾难恢复需求。
93 10
|
28天前
|
运维 网络协议 Linux
CentOS下Bind服务的安装与故障排查
通过以上的步骤,您应该能够在CentOS系统上安装并配置BIND DNS服务,并进行基本的故障排查。
156 0
|
2月前
|
人工智能 数据挖掘 Linux
Centos安装Python3.7(亲测可用)
本指南详细介绍了在基于Linux(以CentOS系统为例,使用yum包管理器)的系统上安装Python 3.7版本的完整流程。Python是一种广泛使用的高级编程语言,在各种领域如软件开发、数据分析、人工智能和区块链开发等都有着重要的应用。
218 2
|
3月前
|
机器人 Linux
CentOS 7系统中安装特定版本CMake 3.21.2的方法。
到这里,过程已经全部完成。如果你跟随上面的步骤来,那么你现在已经拥有了一个全新的CMake版本在你的CentOS 7系统上了。这个过程就像是你通过一系列仪式,唤醒了一个沉睡已久的古老机器人,它现在完全按照你的意愿来帮你构建和编译软件了。
195 18
|
3月前
|
安全 Linux
安装EPEL Repository Centos 7.9
记住,行走在Linux的世界,把“学习”作为你不可或缺的随身宝典。今天你学会了如何将EPEL这座外来的宝库接入你的系统,明天,你或许就能在这座宝库中发现一款能领你走向Linux大师之路的神器。
163 5

热门文章

最新文章