很多時候線上機我們是沒有root的,即使有root權限安裝只有自己用到的庫也不合適,所以在開發過程中,很多時候會用到本地安裝
1、python 安裝
下載:wget https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tgz
解壓:tar zxvf Python-2.7.13.tgz
配置安裝到的路徑:./configure --prefix=/home/zhaohongjie/python/python2.7/
make&&make install
以上四步之後,python已經安裝結束,檢驗一下是否安裝正確,到/home/zhaohongjie/python/python2.7/bin/路徑下執行 ./python2.7
Python 2.7.13 (default, Sep 5 2017, 21:11:25)
[GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
2、beautifulsoup安裝
下載:http://www.crummy.com/software/BeautifulSoup/bs4/download/4.2/
解壓:tar -xzvf beautifulsoup4-4.2.0.tar.gz
安裝:/home/zhaohongjie/python/python2.7/bin/python2.7 setup.py build
/home/zhaohongjie/python/python2.7/bin/python2.7 setup.pyinstall
確認beautifulsoup是否安裝成功,/home/zhaohongjie/python/python2.7/bin/python2.7執行from bs4 import BeautifulSoup。如果不報錯表示安裝成功