Centos安装 python的 pip 、Selenium、lxml、request、
feedparser、Beautifulsoup、Beautifulsoup4、Scray等
pip安装一些东西在python中很常见,但是如何先安装好pip 呢?
以下为centos安装:
pip
[root@iZ94s4ycnl7Z wx]#wget https://bootstrap.pypa.io/get-pip.py
--2016-11-05 23:40:52-- https://bootstrap.pypa.io/get-pip.pyResolving bootstrap.pypa.io (bootstrap.pypa.io)... 151.101.16.175
Connecting to bootstrap.pypa.io (bootstrap.pypa.io)|151.101.16.175|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1524722 (1.5M) [text/x-python]
Saving to: ‘get-pip.py’
100%[==============================================>] 1,524,722 7.38KB/s in 2m 30s
2016-11-05 23:43:26 (9.90 KB/s) - ‘get-pip.py’ saved [1524722/1524722]
[root@iZ94s4ycnl7Z wx]#python get-pip.py
Collecting pipDownloading pip-9.0.0-py2.py3-none-any.whl (1.3MB)
100% |████████████████████████████████| 1.3MB 3.1kB/s
Collecting wheel
Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB)
100% |████████████████████████████████| 71kB 1.6kB/s
Installing collected packages: pip, wheel
Successfully installed pip-9.0.0 wheel-0.29.0
-
selenium
[root@iZ94s4ycnl7Z wx]# pip install -U selenium
Collecting seleniumDownloading selenium-3.0.1-py2.py3-none-any.whl (913kB)
100% |████████████████████████████████| 921kB 18kB/s
Installing collected packages: selenium
Successfully installed selenium-3.0.1
------------------------------------------------------------------------------------------------------
lxml
pip install --upgrade lxml
[root@iZ94s4ycnl7Z wx]# pip install --upgrade lxml
Collecting lxml
Downloading lxml-3.6.4-cp27-cp27mu-manylinux1_x86_64.whl (4.2MB)
100% |████████████████████████████████| 4.2MB 18kB/s
Installing collected packages: lxml
Successfully installed lxml-3.6.4
------------------------------------------------------------------------------------------------------
request
同样easy_install
或pip 都
可以直接使用:easy_install requests
或者pip install requests
来安装。
[root@iZ94s4ycnl7Z bt]#pip install requests
Collecting requestsDownloading requests-2.11.1-py2.py3-none-any.whl (514kB)
100% |████████████████████████████████| 522kB 9.4kB/s
Installing collected packages: requests
Successfully installed requests-2.11.1
------------------------------------------------------------------------------------------------------------
feedparser
pip install feedparser
[root@iZ94s4ycnl7Z ~]# pip install feedparser
Collecting feedparser
Downloading feedparser-5.2.1.zip (1.2MB)
100% |████████████████████████████████| 1.2MB 26kB/s
Building wheels for collected packages: feedparser
Running setup.py bdist_wheel for feedparser ... done
Stored in directory: /root/.cache/pip/wheels/15/ce/10/b500f745822ea6db6ea8ed225c06b15c000d71016b89ef9037
Successfully built feedparser
Installing collected packages: feedparser
Successfully installed feedparser-5.2.1
------------------------------------------------------------------------------------------------------------
Beautifulsoup
pip install Beautifulsoup
[root@iZ94s4ycnl7Z bt]#pip install Beautifulsoup
Collecting Beautifulsoup
Downloading BeautifulSoup-3.2.1.tar.gz
Building wheels for collected packages: Beautifulsoup
Running setup.py bdist_wheel for Beautifulsoup ... done
Stored in directory: /root/.cache/pip/wheels/5e/be/6d/ed01d5d434a821557b674c9da976f60b1b93d9009447eb9d16
Successfully built Beautifulsoup
Installing collected packages: Beautifulsoup
Successfully installed Beautifulsoup-3.2.1
------------------------------------------------------------------------------------------------------------
Beautifulsoup4
wget http://www.crummy.com/software/BeautifulSoup/bs4/download/4.3/beautifulsoup4-4.3.2.tar.gz
tar -zxvf beautifulsoup4-4.3.2.tar.gz
cd beautifulsoup4-4.3.2
python setup.py install
[root@iZ94s4ycnl7Z bt]# wget http://www.crummy.com/software/BeautifulSoup/bs4/download/4.3/beautifulsoup4-4.3.2.tar.gz
--2016-11-06 00:26:02-- http://www.crummy.com/software/BeautifulSoup/bs4/download/4.3/beautifulsoup4-4.3.2.tar.gz
Resolving www.crummy.com (www.crummy.com)... 66.160.141.133
Connecting to www.crummy.com (www.crummy.com)|66.160.141.133|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://www.crummy.com/software/BeautifulSoup/bs4/download/4.3/beautifulsoup4-4.3.2.tar.gz [following]
--2016-11-06 00:26:04-- https://www.crummy.com/software/BeautifulSoup/bs4/download/4.3/beautifulsoup4-4.3.2.tar.gz
Connecting to www.crummy.com (www.crummy.com)|66.160.141.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 143356 (140K) [application/x-gzip]
Saving to: ‘beautifulsoup4-4.3.2.tar.gz’
100%[==============================================>] 143,356 36.5KB/s in 3.8s
2016-11-06 00:26:09 (36.5 KB/s) - ‘beautifulsoup4-4.3.2.tar.gz’ saved [143356/143356]
[root@iZ94s4ycnl7Z bt]# tar -zxvf beautifulsoup4-4.3.2.tar.gz
beautifulsoup4-4.3.2/
beautifulsoup4-4.3.2/setup.py
beautifulsoup4-4.3.2/TODO.txt
beautifulsoup4-4.3.2/PKG-INFO
beautifulsoup4-4.3.2/doc/
beautifulsoup4-4.3.2/doc/Makefile
beautifulsoup4-4.3.2/doc/source/
beautifulsoup4-4.3.2/doc/source/conf.py
beautifulsoup4-4.3.2/doc/source/index.rst
beautifulsoup4-4.3.2/doc/source/6.1.jpg
beautifulsoup4-4.3.2/scripts/
beautifulsoup4-4.3.2/scripts/demonstration_markup.txt
beautifulsoup4-4.3.2/scripts/demonstrate_parser_differences.py
beautifulsoup4-4.3.2/NEWS.txt
beautifulsoup4-4.3.2/AUTHORS.txt
beautifulsoup4-4.3.2/README.txt
beautifulsoup4-4.3.2/COPYING.txt
beautifulsoup4-4.3.2/bs4/
beautifulsoup4-4.3.2/bs4/tests/
beautifulsoup4-4.3.2/bs4/tests/test_soup.py
beautifulsoup4-4.3.2/bs4/tests/test_htmlparser.py
beautifulsoup4-4.3.2/bs4/tests/test_docs.py
beautifulsoup4-4.3.2/bs4/tests/test_lxml.py
beautifulsoup4-4.3.2/bs4/tests/test_builder_registry.py
beautifulsoup4-4.3.2/bs4/tests/__init__.py
beautifulsoup4-4.3.2/bs4/tests/test_tree.py
beautifulsoup4-4.3.2/bs4/tests/test_html5lib.py
beautifulsoup4-4.3.2/bs4/builder/
beautifulsoup4-4.3.2/bs4/builder/_lxml.py
beautifulsoup4-4.3.2/bs4/builder/__init__.py
beautifulsoup4-4.3.2/bs4/builder/_html5lib.py
beautifulsoup4-4.3.2/bs4/builder/_htmlparser.py
beautifulsoup4-4.3.2/bs4/diagnose.py
beautifulsoup4-4.3.2/bs4/element.py
beautifulsoup4-4.3.2/bs4/dammit.py
beautifulsoup4-4.3.2/bs4/__init__.py
beautifulsoup4-4.3.2/bs4/testing.py
[root@iZ94s4ycnl7Z bt]# cd beautifulsoup4-4.3.2
[root@iZ94s4ycnl7Z beautifulsoup4-4.3.2]# python setup.py install
running install
running build
running build_py
creating build
creating build/lib
creating build/lib/bs4
copying bs4/diagnose.py -> build/lib/bs4
copying bs4/testing.py -> build/lib/bs4
copying bs4/__init__.py -> build/lib/bs4
copying bs4/element.py -> build/lib/bs4
copying bs4/dammit.py -> build/lib/bs4
creating build/lib/bs4/builder
copying bs4/builder/__init__.py -> build/lib/bs4/builder
copying bs4/builder/_lxml.py -> build/lib/bs4/builder
copying bs4/builder/_html5lib.py -> build/lib/bs4/builder
copying bs4/builder/_htmlparser.py -> build/lib/bs4/builder
creating build/lib/bs4/tests
copying bs4/tests/test_lxml.py -> build/lib/bs4/tests
copying bs4/tests/test_tree.py -> build/lib/bs4/tests
copying bs4/tests/test_docs.py -> build/lib/bs4/tests
copying bs4/tests/test_soup.py -> build/lib/bs4/tests
copying bs4/tests/test_htmlparser.py -> build/lib/bs4/tests
copying bs4/tests/__init__.py -> build/lib/bs4/tests
copying bs4/tests/test_html5lib.py -> build/lib/bs4/tests
copying bs4/tests/test_builder_registry.py -> build/lib/bs4/tests
running install_lib
creating /usr/lib/python2.7/site-packages/bs4
copying build/lib/bs4/diagnose.py -> /usr/lib/python2.7/site-packages/bs4
copying build/lib/bs4/testing.py -> /usr/lib/python2.7/site-packages/bs4
copying build/lib/bs4/__init__.py -> /usr/lib/python2.7/site-packages/bs4
copying build/lib/bs4/element.py -> /usr/lib/python2.7/site-packages/bs4
creating /usr/lib/python2.7/site-packages/bs4/builder
copying build/lib/bs4/builder/__init__.py -> /usr/lib/python2.7/site-packages/bs4/builder
copying build/lib/bs4/builder/_lxml.py -> /usr/lib/python2.7/site-packages/bs4/builder
copying build/lib/bs4/builder/_html5lib.py -> /usr/lib/python2.7/site-packages/bs4/builder
copying build/lib/bs4/builder/_htmlparser.py -> /usr/lib/python2.7/site-packages/bs4/builder
creating /usr/lib/python2.7/site-packages/bs4/tests
copying build/lib/bs4/tests/test_lxml.py -> /usr/lib/python2.7/site-packages/bs4/tests
copying build/lib/bs4/tests/test_tree.py -> /usr/lib/python2.7/site-packages/bs4/tests
copying build/lib/bs4/tests/test_docs.py -> /usr/lib/python2.7/site-packages/bs4/tests
copying build/lib/bs4/tests/test_soup.py -> /usr/lib/python2.7/site-packages/bs4/tests
copying build/lib/bs4/tests/test_htmlparser.py -> /usr/lib/python2.7/site-packages/bs4/tests
copying build/lib/bs4/tests/__init__.py -> /usr/lib/python2.7/site-packages/bs4/tests
copying build/lib/bs4/tests/test_html5lib.py -> /usr/lib/python2.7/site-packages/bs4/tests
copying build/lib/bs4/tests/test_builder_registry.py -> /usr/lib/python2.7/site-packages/bs4/tests
copying build/lib/bs4/dammit.py -> /usr/lib/python2.7/site-packages/bs4
byte-compiling /usr/lib/python2.7/site-packages/bs4/diagnose.py to diagnose.pyc
byte-compiling /usr/lib/python2.7/site-packages/bs4/testing.py to testing.pyc
byte-compiling /usr/lib/python2.7/site-packages/bs4/__init__.py to __init__.pyc
byte-compiling /usr/lib/python2.7/site-packages/bs4/element.py to element.pyc
byte-compiling /usr/lib/python2.7/site-packages/bs4/builder/__init__.py to __init__.pyc
byte-compiling /usr/lib/python2.7/site-packages/bs4/builder/_lxml.py to _lxml.pyc
byte-compiling /usr/lib/python2.7/site-packages/bs4/builder/_html5lib.py to _html5lib.pyc
byte-compiling /usr/lib/python2.7/site-packages/bs4/builder/_htmlparser.py to _htmlparser.pyc
byte-compiling /usr/lib/python2.7/site-packages/bs4/tests/test_lxml.py to test_lxml.pyc
byte-compiling /usr/lib/python2.7/site-packages/bs4/tests/test_tree.py to test_tree.pyc
byte-compiling /usr/lib/python2.7/site-packages/bs4/tests/test_docs.py to test_docs.pyc
byte-compiling /usr/lib/python2.7/site-packages/bs4/tests/test_soup.py to test_soup.pyc
byte-compiling /usr/lib/python2.7/site-packages/bs4/tests/test_htmlparser.py to test_htmlparser.pyc
byte-compiling /usr/lib/python2.7/site-packages/bs4/tests/__init__.py to __init__.pyc
byte-compiling /usr/lib/python2.7/site-packages/bs4/tests/test_html5lib.py to test_html5lib.pyc
byte-compiling /usr/lib/python2.7/site-packages/bs4/tests/test_builder_registry.py to test_builder_registry.pyc
byte-compiling /usr/lib/python2.7/site-packages/bs4/dammit.py to dammit.pyc
running install_egg_info
Writing /usr/lib/python2.7/site-packages/beautifulsoup4-4.3.2-py2.7.egg-info
Scrapy
pip install Scrapy
Ubuntu14.04
http://jingyan.baidu.com/article/f3ad7d0f129c7809c2345b56.html
http://www.jb51.net/article/48607.htm
模块安装好,脚本可以正常导入使用。