Recommended way to install pip(3) on centos7

前端 未结 8 1810
梦如初夏
梦如初夏 2020-12-08 07:12

I am interrested in knowing the recommended way to install pip3 for python3.6 (as of today, may 2018) on current version of centos7 (7.5.1804) and the accepted answer of How

相关标签:
8条回答
  • 2020-12-08 07:30

    Follow these commands in Centos 7

    yum install python36
    yum install python36-devel
    yum install python36-setuptools
    easy_install-3.6 pip
    

    to check the pip version:

    pip3 -V
    pip 18.0 from /usr/local/lib/python3.6/site-packages/pip-18.0-py3.6.egg/pip (python 3.6)
    
    0 讨论(0)
  • 2020-12-08 07:30

    Try This::

    sudo yum update
    sudo yum install -y python36u python36u-libs python36u-devel python36u-pip
    

    Working for me perfectly.

    0 讨论(0)
  • 2020-12-08 07:37

    In case you're seeing that pip3 is linked to python2 path:

    $ pip3 -V

    pip 8.1.2 from /usr/lib/python2.7/site-packages/pip (python 2.7)

    You'll probably get:

    $ pip3 install --upgrade pip

    TypeError: parse() got an unexpected keyword argument 'transport_encoding'

    Then try to clear commands cache with hash -r. This has worked for me:

    # Install Python 3:
    sudo yum install python36 -y
    
    # Install & Upgrade pip3
    sudo python36 -m pip install --upgrade pip
    
    # Validate pip3 installation:
    sudo python3.6 -m ensurepip
    #  Successfully installed pip-10.0.1 setuptools-39.0.1
    
    # Clear commands cache
    hash -r
    # might be required if getting in bash: /usr/bin/pip3: No such file or directory)
    
    pip3 -V
    # pip 19.0.3 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)
    
    which pip3
    # /usr/local/bin/pip3
    
    pip2 -V
    # pip 8.1.2 from /usr/lib/python2.7/site-packages (python 2.7)
    
    which pip2
    # /usr/local/bin/pip2
    
    # Install your Python3 module:
    sudo /usr/local/bin/pip3 install {required module for python3}
    
    0 讨论(0)
  • 2020-12-08 07:37

    I got this error when I tried to install python36 over the built-in centos7 python 2.7.5 version:

    Transaction check error:
      file /etc/rpm/macros.python from install of python-rpm-macros-3-32.el7.noarch conflicts with file from package python-devel-2.7.5-80.el7_6.x86_64
    

    And I fixed it with these:

    yum install python36
    yum update python-devel
    yum install python36-devel
    easy_install-3.6 pip
    
    0 讨论(0)
  • 2020-12-08 07:38

    To install pip for python 3.6 on CentOS 7 you need to run

    $ python3.6 -m ensurepip

    0 讨论(0)
  • 2020-12-08 07:39

    There is now a python3-pip package in the CentOS 7 base repository as of 2019-08-22. There is no longer a need for third-party repositories or packages.

    Installing python3-pip will also install libtirpc, python3, python3-libs, and python3-setuptools:

    yum install --assumeyes python3-pip
    

    You can now verify the version (yes, it is old, but it's what is coming from the base repository):

    $ pip3 --version
    pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6)
    

    If you don't want to stray from the files provided by the python3-pip package, and you don't want to see warnings about pip being old, see https://stackoverflow.com/a/46288945/534275 for silencing the messages.

    0 讨论(0)
提交回复
热议问题