pip类似RedHat里面的yum,安装Python包非常方便。本节详细介绍pip的安装、以及使用方法

1、下载pip安装包

[root@localhost ~]# wget https://pypi.python.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/pip-9.0.1.tar.gz#md5=35f01da33009719497f01a4ba69d63c9

2、解压pip安装包

[root@localhost ~]# tar xf pip-9.0..tar.gz 

3、安装pip

[root@localhost ~]# cd pip-9.0.
[root@localhost pip-9.0.]# python3 setup.py install

4、pip使用详解

  • pip安装模块报错,提示没有ssl模块

    [root@localhost ipython-6.1.]# pip install traitlets
    pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
    Collecting traitlets
    Could not fetch URL https://pypi.python.org/simple/traitlets/: There was a problem confirming the ssl certificate: Can't connect to HTTPS URL because the SSL module is not available. - skipping
    Could not find a version that satisfies the requirement traitlets (from versions: )
    No matching distribution found for traitlets
    #没有安装openssl-devel,然后重新编译安装python3.
    [root@localhost pip-9.0.]# yum install openssl-devel -y
    #进入python3.6解压包目录
    [root@localhost Python-3.6.]#make clean
    [root@localhost Python-3.6.]# ./configure
    [root@localhost Python-3.6.]# make && make install
  • 安装openssl-devel并重新编译安装python3后,再次测试pip安装模块
    [root@localhost ~]# pip install 'traitlets'
    Collecting traitlets
    Downloading traitlets-4.3.-py2.py3-none-any.whl (74kB)
    % |?..?..?..?..?..?..?..?..?..?..?..?..?..?..?..?..| 81kB 87kB/s
    Collecting six (from traitlets)
    Downloading six-1.10.-py2.py3-none-any.whl
    Collecting ipython-genutils (from traitlets)
    Downloading ipython_genutils-0.2.-py2.py3-none-any.whl
    Collecting decorator (from traitlets)
    Downloading decorator-4.0.-py2.py3-none-any.whl
    Installing collected packages: six, ipython-genutils, decorator, traitlets
    Successfully installed decorator-4.0. ipython-genutils-0.2. six-1.10. traitlets-4.3.
    #安装成功
  • pip uninstall Package:卸载模块
    [root@localhost pip-9.0.]# pip uninstall traitlets
    Uninstalling traitlets-4.3.:
    ......
    packages/traitlets/utils/tests/test_importstring.py
    Proceed (y/n)? y
    Successfully uninstalled traitlets-4.3.
  • pip freeze:按需求格式输出已安装的模块
    [root@localhost pip-9.0.]# pip freeze
    decorator==4.0.
    ipython==6.1.
    ipython-genutils==0.2.
    pexpect==4.2.
    ptyprocess==0.5.
    Pygments==2.2.
    six==1.10.
    traitlets==4.3.
  • pip list  --format=(legacy|columns):安装指定格式输出已安装的模块;和pip freeze类似
    [root@localhost pip-9.0.]# pip list --format=legacy
    decorator (4.0.)
    ipython (6.1.)
    ipython-genutils (0.2.)
    pexpect (4.2.)
    pip (9.0.)
    ptyprocess (0.5.)
    Pygments (2.2.)
    setuptools (28.8.)
    six (1.10.)
    traitlets (4.3.)
    [root@localhost pip-9.0.]# pip list --format=columns
    Package Version
    ---------------- -------
    decorator 4.0.
    ipython 6.1.
    ipython-genutils 0.2.
    pexpect 4.2.
    pip 9.0.
    ptyprocess 0.5.
    Pygments 2.2.
    setuptools 28.8.
    six 1.10.
    traitlets 4.3.
  • pip show Package:显示已安装的模块信息
    [root@localhost pip-9.0.]# pip show traitlets
    Name: traitlets
    Version: 4.3.
    Summary: Traitlets Python config system
    Home-page: http://ipython.org
    Author: IPython Development Team
    Author-email: ipython-dev@scipy.org
    License: BSD
    Location: /usr/local/lib/python3./site-packages
    Requires: ipython-genutils, six, decorator
  • pip -h:余下的选项可以通过-h查看,这里不做过多介绍
    [root@localhost pip-9.0.]# pip -h
    
    Usage:
    pip <command> [options] Commands:
    install Install packages.
    download Download packages.
    uninstall Uninstall packages.
    freeze Output installed packages in requirements format.
    list List installed packages.
    show Show information about installed packages.
    check Verify installed packages have compatible dependencies.
    search Search PyPI for packages.
    wheel Build wheels from your requirements.
    hash Compute hashes of package archives.
    completion A helper command used for command completion.
    help Show help for commands. General Options:
    -h, --help Show help.
    --isolated Run pip in an isolated mode, ignoring environment variables and user configuration.
    -v, --verbose Give more output. Option is additive, and can be used up to times.
    -V, --version Show version and exit.
    -q, --quiet Give less output. Option is additive, and can be used up to times (corresponding to WARNING, ERROR, and CRITICAL logging levels).
    --log <path> Path to a verbose appending log.
    --proxy <proxy> Specify a proxy in the form [user:passwd@]proxy.server:port.
    --retries <retries> Maximum number of retries each connection should attempt (default times).
    --timeout <sec> Set the socket timeout (default seconds).
    --exists-action <action> Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort.
    --trusted-host <hostname> Mark this host as trusted, even though it does not have valid or any HTTPS.
    --cert <path> Path to alternate CA bundle.
    --client-cert <path> Path to SSL client certificate, a single file containing the private key and the certificate in PEM format.
    --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.

Centos7下python3安装pip-9.0.1的更多相关文章

  1. CentOS7.5 Python3安装pip报错:ModuleNotFoundError: No module named '_ctypes' --Python3

    1.问题:pyhontModuleNotFoundError: No module named '_ctypes'  操作系统:CentOS7.5 安装完Pyhotn3后(如何安装Python3,安装 ...

  2. Windows下python3安装pip管理包(转贴)

    方法有两种: 请参考:http://www.pip-installer.org/en/latest/installing.html#prerequisites 1.通过setuptools安装 安装s ...

  3. Centos7下python3安装ipython

    一.通过压缩包安装ipython 1.下载ipython安装包 [root@localhost ~]# wget https://pypi.python.org/packages/79/63/b671 ...

  4. centos7下编译安装nginx-1.16.0

    一.下载nginx源码 http://nginx.org/en/download.html 如:nginx-1.16.0.tar.gz 二.创建用户和组,并解压 groupadd www userad ...

  5. centos7下编译安装php-7.0.15(PHP-FPM)

    centos7下编译安装php-7.0.15(PHP-FPM) 一.下载php7源码包 http://php.net/downloads.php 如:php-7.0.15.tar.gz 二.安装所需依 ...

  6. Linux(CentOS7)下rpm安装MySQL8.0.16

    记录一下自己在 CentOS7 下 rpm 安装 MySQL8.0.16 的过程. 一.准备工作 1. 下载MySQL所需要的安装包 从 MySQL官网 下载,上传至 CentOS 系统 /usr/l ...

  7. CentOS7下编译安装redis-5.0.9

    CentOS7下编译安装redis-5.0.9 本文地址http://yangjianyong.cn/?p=171转载无需经过作者本人授权 下载redis #code start wget https ...

  8. Centos7下python3.7的pipSSLError问题

    在Centos7下成功安装了python3.7, 但是在使用pip3的时候出现了以下错误 中间试过了网上大家给出的好多种办法,一开始我只是在编译的时候 ./configure --with-ssl(p ...

  9. Ubuntu16.04下编译安装OpenCV3.4.0(C++ & python)

    Ubuntu16.04下编译安装OpenCV3.4.0(C++ & python) 前提是已经安装了python2,python3 1)安装各种依赖库 sudo apt-get update ...

随机推荐

  1. 在 Azure VM 中使用应用商店映像创建 HPC Pack 群集的头节点

    使用 Azure 应用商店和 Azure 门户中的 Microsoft HPC Pack 2012 R2 虚拟机映像创建 HPC 群集的头节点. 此 HPC Pack VM 映像基于预安装了 HPC ...

  2. redis之安装与简单使用

    python操作redis: https://www.cnblogs.com/melonjiang/p/5342505.html https://www.jianshu.com/p/2639549be ...

  3. 解决VS调试Web应用无问题而部署在IIS上报500和403的问题

    [问题:报500]不能在此路径中使用此配置节.如果在父级别上锁定了该节,便会出现这种情况.锁定是默认设置的(overrideModeDefault="Deny" [解决方案] 运行 ...

  4. 转:Newtonsoft.Json高级用法

    原文地址:http://www.cnblogs.com/yanweidie/p/4605212.html 手机端应用讲究速度快,体验好.刚好手头上的一个项目服务端接口有性能问题,需要进行优化.在接口多 ...

  5. Java中几种常用数据类型之间转换的方法

    Java中几种常用的数据类型之间转换方法: 1. short-->int 转换 exp: short shortvar=0; int intvar=0; shortvar= (short) in ...

  6. Django商城项目笔记No.7用户部分-注册接口-判断用户名和手机号是否存在

    Django商城项目笔记No.7用户部分-注册接口-判断用户名和手机号是否存在 判断用户名是否存在 后端视图代码实现,在users/view.py里编写如下代码 class UsernameCount ...

  7. Articulate Presenter文字乱码的排除

    Articulate Presenter乱码的问题如何设置? 字体乱码的设置: 1.首先如果ppt中有中文内容,肯定需要将Articulate Presenter的Character Set设置为No ...

  8. Scala学习之路 (九)Scala的上界和下届

    一.泛型 1.泛型的介绍 泛型用于指定方法或类可以接受任意类型参数,参数在实际使用时才被确定,泛型可以有效地增强程序的适用性,使用泛型可以使得类或方法具有更强的通用性.泛型的典型应用场景是集合及集合中 ...

  9. POJ 3415 Common Substrings 【长度不小于 K 的公共子串的个数】

    传送门:http://poj.org/problem?id=3415 题意:给定两个串,求长度不小于 k 的公共子串的个数 解题思路: 常用技巧,通过在中间添加特殊标记符连接两个串,把两个串的问题转换 ...

  10. WorldWind源码剖析系列:外包围盒类BoundingBox和外包围球类BoundingSphere

    PluginSDK中的外包围盒.外包围球分别用类 BoundingBox和BoundingSphere描述,其类图如下所示. 外包围盒BoundingBox类的corners字段用来存储外包围盒的8个 ...