zoukankan      html  css  js  c++  java
  • 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

     

  • 相关阅读:
    <强化学习>无模型下计算给定策略对应的价值函数,Model free Prediction,评估一个给定策略的表现
    <强化学习>马尔可夫决策过程MDP
    <组合数学>排列组合(2)/可重组合,不相邻组合,SJT算法
    <组合数学>排列组合(1)/格路模型,范德蒙德恒等式
    <组合数学>计数/加减乘除计数/加法法则/乘法法则/减法法则
    <组合数学>开门帖
    <组合数学>幻方
    Windows装机必备
    利用Jmeter操作MySQL数据库
    利用Jenkins插件实现多个job并行后再触发job
  • 原文地址:https://www.cnblogs.com/xiaochina/p/6220937.html
Copyright © 2011-2022 走看看