Centos7下python3安装pip-9.0.1

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

1、下载pip安装包

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

2、解压pip安装包

[[email protected] ~]# tar xf pip-9.0.1.tar.gz 

3、安装pip

[[email protected] ~]# cd pip-9.0.1
[[email protected] pip-9.0.1]# python3 setup.py install

4、pip使用详解

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

    [[email protected] ipython-6.1.0]# 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.6
    [[email protected] pip-9.0.1]# yum install openssl-devel -y#进入python3.6解压包目录
    [[email protected] Python-3.6.1]#make clean
    [[email protected] Python-3.6.1]# ./configure
    [[email protected] Python-3.6.1]# make && make install

  • 安装openssl-devel并重新编译安装python3后,再次测试pip安装模块

    [[email protected] ~]# pip install ‘traitlets‘
    Collecting traitlets
      Downloading traitlets-4.3.2-py2.py3-none-any.whl (74kB)
        100% |?..?..?..?..?..?..?..?..?..?..?..?..?..?..?..?..| 81kB 87kB/s
    Collecting six (from traitlets)
      Downloading six-1.10.0-py2.py3-none-any.whl
    Collecting ipython-genutils (from traitlets)
      Downloading ipython_genutils-0.2.0-py2.py3-none-any.whl
    Collecting decorator (from traitlets)
      Downloading decorator-4.0.11-py2.py3-none-any.whl
    Installing collected packages: six, ipython-genutils, decorator, traitlets
    Successfully installed decorator-4.0.11 ipython-genutils-0.2.0 six-1.10.0 traitlets-4.3.2
    #安装成功

  • pip uninstall Package:卸载模块

    [[email protected] pip-9.0.1]# pip uninstall traitlets
    Uninstalling traitlets-4.3.2:
    ......
    packages/traitlets/utils/tests/test_importstring.py
    Proceed (y/n)? y
      Successfully uninstalled traitlets-4.3.2
  • pip freeze:按需求格式输出已安装的模块

    [[email protected] pip-9.0.1]# pip freeze
    decorator==4.0.11
    ipython==6.1.0
    ipython-genutils==0.2.0
    pexpect==4.2.1
    ptyprocess==0.5.2
    Pygments==2.2.0
    six==1.10.0
    traitlets==4.3.2

  • pip list  --format=(legacy|columns):安装指定格式输出已安装的模块;和pip freeze类似

    [[email protected] pip-9.0.1]# pip list --format=legacy
    decorator (4.0.11)
    ipython (6.1.0)
    ipython-genutils (0.2.0)
    pexpect (4.2.1)
    pip (9.0.1)
    ptyprocess (0.5.2)
    Pygments (2.2.0)
    setuptools (28.8.0)
    six (1.10.0)
    traitlets (4.3.2)
    [[email protected] pip-9.0.1]# pip list --format=columns
    Package          Version
    ---------------- -------
    decorator        4.0.11
    ipython          6.1.0
    ipython-genutils 0.2.0
    pexpect          4.2.1
    pip              9.0.1
    ptyprocess       0.5.2
    Pygments         2.2.0
    setuptools       28.8.0
    six              1.10.0
    traitlets        4.3.2 

  • pip show Package:显示已安装的模块信息

    [[email protected] pip-9.0.1]# pip show traitlets
    Name: traitlets
    Version: 4.3.2
    Summary: Traitlets Python config system
    Home-page: http://ipython.org
    Author: IPython Development Team
    Author-email: [email protected]
    License: BSD
    Location: /usr/local/lib/python3.6/site-packages
    Requires: ipython-genutils, six, decorator

  • pip -h:余下的选项可以通过-h查看,这里不做过多介绍

    [[email protected] pip-9.0.1]# 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 3 times.
      -V, --version               Show version and exit.
      -q, --quiet                 Give less output. Option is additive, and can be used up to 3 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:[email protected]]proxy.server:port.
      --retries <retries>         Maximum number of retries each connection should attempt (default 5 times).
      --timeout <sec>             Set the socket timeout (default 15 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.
    
    来源:http://www.cnblogs.com/chengd/p/7078588.html
时间: 2024-10-09 15:04:39

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

CentOS7.5 Python3安装pip报错:ModuleNotFoundError: No module named &#39;_ctypes&#39; --Python3

1.问题:pyhontModuleNotFoundError: No module named '_ctypes'  操作系统:CentOS7.5 安装完Pyhotn3后(如何安装Python3,安装后我的python.python3命令指向python3;python2命令和python2.7指向python2.7),发现没有安装两个版本都没有pip.所以下载好pip包,用系统自带python2安装如下所示: [root@VM_39_157_centos ~]# wget https://fi

Centos7下python3安装ipython

一.通过压缩包安装ipython 1.下载ipython安装包 [[email protected] ~]# wget https://pypi.python.org/packages/79/63/b671fc2bf0051739e87a7478a207bbeb45cfae3c328d38ccdd063d9e0074/ipython-6.1.0.tar.gz#md5=1e15e1ce3f3f722da6935d7ac0e51346 2.安装ipython [[email protected] ~

Mac os下Python3安装Django

1.查看pip版本 没有的话就是没安装成功 安装python的时候一般会自动安装pip //pip版本 pip -V //对应python2.7 pip 9.0.1 from /Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg (python 2.7) pip3 -V //对应python3.6 pip 9.0.1 from /Library/Frameworks/Python.framework/Versions/3.6/lib/pyth

EnvironmentError: mysql_config not found问题解决(centos7下python安装mysql-python)

centos7下python安装mysql-python模块,执行命令: pip install mysql-python 出现报错:EnvironmentError: mysql_config not found 网上查了一下需安装mysql-devel yum -y install mysql-devel 安装成功后,执行命令python setup.py install 又出现报错:error: command 'gcc' failed with exit status 1 明明装了gcc

Centos7下yum安装mongodb

https://www.cnblogs.com/flying1819/articles/9035408.html Centos7下yum安装mongodb 简介 MongoDB 是一个基于分布式 文件存储的NoSQL数据库 由C++语言编写,运行稳定,性能高 旨在为 WEB 应用提供可扩展的高性能数据存储解决方案 查看官方网站 MongoDB特点 模式自由 :可以把不同结构的文档存储在同一个数据库里 面向集合的存储:适合存储 JSON风格文件的形式 完整的索引支持:对任何属性可索引 复制和高可用

windows环境下python3安装Crypto

windows环境下python3安装Crypto crypto在python上面的名字是pycrypto,它是一个第三方库,但是已经停止更新三年了,所以不建议安装这个库: pycryptodome是pycrypto的延伸版本,用法和pycrypto是一模一样的: pip install pycryptodome 在使用的时候导入模块可能存在问题,需要修改一个文件夹的名称 Python\Python36\Lib\site-packages,找到这个路径,下面有一个文件夹叫做crypto,将小写c

Centos7.2.1511安装Zabbix 3.0

Centos7.2.1511安装Zabbix 3.0 先在虚拟机中安装好CentOS 7.2.1511,并设置好IP,允许虚拟机联网. 查看系统版本 cat /etc/redhat-release 1.安装MySQL 从最新版本的linux系统开始,默认的是 Mariadb而不是mysql! 使用系统自带的repos安装很简单: #yum install -y mariadb mariadb-server 启动mariadb #systemctl start mariadb 之前的服务管理命令还

多版本python下,安装pip

前天在CentOS中安装了python2.7.12和python3.5.2,今天要为两个版本安装pip,从官方上下载了get-pip.py,使用python get-pip.py,出现错误,无法安装.通过查找原因,总算是安装上了. 下面我来说明一下: 1.出现的问题 1),没有zlib库 2),没有HTTPSHander库 2.解决方法 在安装python这两个版本前,需要安装两个库zlib-devel和openssl-devel,安装完成这两个后,再对python进行编译安装后,就可以正常安装

Docker1.8在Centos7下的安装

1.创建docker的yum库 [[email protected]~]# cd /etc/yum.repos.d/ [[email protected]]# vim docker.repo [dockerrepo] name=DockerRepository baseurl=https://yum.dockerproject.org/repo/main/centos/7 enabled=1 gpgcheck=1 gpgkey=https://yum.dockerproject.org/gpg