How to install pip in CentOS 7?

2019-01-10 05:47发布

CentOS 7 EPEL now includes Python 3.4: yum install python34

However, when I try that, even though Python 3.4 installs successfully, it doesn't appear to install pip. Which is weird, because pip should be included by default with Python 3.4. which pip3 doesn't find anything, nor does which pip.

How do I access pip from the Python 3.4 package in CentOS 7 EPEL release?

9条回答
太酷不给撩
2楼-- · 2019-01-10 06:12

There is a easy way of doing this by just using easy_install (A Setuptools to package python librarie).

  • Assumption. Before doing this check whether you have python installed into your Centos machine (at least 2.x).

  • Steps to install pip.

    1. So lets do install easy_install,

      sudo yum install python-setuptools python-setuptools-devel

    2. Now lets do pip with easy_install,

      sudo easy_install pip

That's Great. Now you have pip :)

查看更多
干净又极端
3楼-- · 2019-01-10 06:22

Figure out what version of python3 you have installed:

yum search pip

and then install the best match. Use reqoquery to find name of resulting pip3.e.g

repoquery -l python36u-pip

tells me to use pip3.6 instead of pip3

查看更多
一夜七次
4楼-- · 2019-01-10 06:22

Below are the steps I followed to install python34 and pip

yum update -y
yum -y install yum-utils
yum -y groupinstall development
yum -y install https://centos7.iuscommunity.org/ius-release.rpm
yum makecache
yum -y install python34u  python34u-pip
python3.6 -v
echo "alias python=/usr/bin/python3.4" >> ~/.bash_profile
source ~/.bash_profile
pip3 install --upgrade pip

# if yum install python34u-pip doesnt work, try 

curl https://bootstrap.pypa.io/get-pip.py | python
查看更多
The star\"
5楼-- · 2019-01-10 06:32
curl https://bootstrap.pypa.io/get-pip.py | python3.4

Or if you don't have curl for some reason:

wget https://bootstrap.pypa.io/get-pip.py
python3.4 get-pip.py

After this you should be able to run

$ pip3
查看更多
▲ chillily
6楼-- · 2019-01-10 06:32

On CentOS 7, the pip version is pip3.4 and is located here:

/usr/local/bin/pip3.4
查看更多
小情绪 Triste *
7楼-- · 2019-01-10 06:34
yum install python34-pip

pip3.4 install foo

You will likely need the EPEL repositories installed:

yum install -y epel-release

查看更多
登录 后发表回答