pip簡單配置


   pip安裝Python模塊的工具,等價於Redhat中的yum!

01、下載

百度雲盤:http://pan.baidu.com/s/1eRHGBfk             ###相關的

Linux很多都默認安裝Python,python -V  #查看python版本

python

https://www.python.org/downloads/source/

Python-2.6.6.tgz   :點擊下載

Python2.7.13      :點擊下載

tar Jxf Python-2.7.13.tar.xz

./configure  && make && make install

setuptools

https://pypi.python.org/pypi/setuptools

###setuptools的作用:Easily download, build, install, upgrade, and uninstall Python packages

setuptools-32.3.0.zip:點擊下載

###報錯提示

[root@bang pip-9.0.1]# python setup.py install
Traceback (most recent call last):
  File "setup.py", line 6, in <module>
    from setuptools import setup, find_packages
ImportError: No module named setuptools

###解決方案

安裝setuptools

    unzip  setuptools-32.3.0.zip

    cd setuptools

    python setup.py install

pip

https://pypi.python.org/pypi/pip

 pip-9.0.1.tar.gz:點擊下載

https://pip.pypa.io/en/stable/   ###pip官方文檔

tar zxf   pip-9.0.1.tar.gz

python setup.py install

02、pip用法:

# pip --help
 
Usage:   
  pip <command> [options]
 
Commands:
  install                     安裝包.
  uninstall                   卸載包.
  freeze                      按着一定格式輸出已安裝包列表
  list                        列出已安裝包.
  show                        顯示包詳細信息.
  search                      搜索包,類似yum里的search.
  wheel                       Build wheels from your requirements.
  zip                         不推薦. Zip individual packages.
  unzip                       不推薦. Unzip individual packages.
  bundle                      不推薦. Create pybundles.
  help                        當前幫助.
 
General Options:
  -h, --help                  顯示幫助.
  -v, --verbose               更多的輸出,最多可以使用3次
  -V, --version               現實版本信息然后退出.
  -q, --quiet                 最少的輸出.
  --log-file <path>           覆蓋的方式記錄verbose錯誤日志,默認文件:/root/.pip/pip.log
  --log <path>                不覆蓋記錄verbose輸出的日志.
  --proxy <proxy>             Specify a proxy in the form [user:passwd@]proxy.server:port.
  --timeout <sec>             連接超時時間 (默認15秒).
  --exists-action <action>    Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup.
  --cert <path>               證書.
  --cache-dir <dir>           Store the cache data in <dir>.
  --no-cache-dir              Disable the cache.
  --disable-pip-version-check
                              Don't periodically check PyPI to determine whether a new
                              version of pip is available for download. Implied with --no-
                              index.
 

pip install --cacahe-dir .  shinken*.tar.gz            ###安裝本地的python編寫的文件

03、配置pip源

pip源,采用阿里雲的pip源用於加速下載文件

阿里雲:http://mirrors.aliyun.com/help/pypi

在~/.pip/pip.conf

[global] index-url = http://mirrors.aliyun.com/pypi/simple/

[install] trusted-host=mirrors.aliyun.com

 

04、采用yum或apt-get

yum install -y python-setuptools python-pip

apt-get install python-setuptools python-pip

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM