Centos7 安装pip
· 技术积累 · pip

最小化安装完centos系统,默认是没有pip命令的

安装pip

yum install python-pip
Loaded plugins: fastestmirror
base                                                                                                                                                                | 3.6 kB  00:00:00     
epel/x86_64/metalink                                                                                                                                                | 5.1 kB  00:00:00     
epel                                                                                                                                                                | 4.7 kB  00:00:00     
extras                                                                                                                                                              | 3.4 kB  00:00:00     
updates                                                                                                                                                             | 3.4 kB  00:00:00     
(1/4): epel/x86_64/updateinfo                                                                                                                                       | 991 kB  00:00:01     
(2/4): extras/7/x86_64/primary_db                                                                                                                                   | 188 kB  00:00:00     
(3/4): updates/7/x86_64/primary_db                                                                                                                                  | 3.4 MB  00:00:00     
(4/4): epel/x86_64/primary_db                                                                                                                                       | 6.7 MB  00:00:03     
Determining fastest mirrors
 * base: mirrors.zju.edu.cn
 * epel: fedora.cs.nctu.edu.tw
 * extras: ftp.sjtu.edu.cn
 * updates: mirrors.zju.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package python2-pip.noarch 0:8.1.2-8.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================================================================================================================
 Package                                         Arch                                       Version                                         Repository                                Size
===========================================================================================================================================================================================
Installing:
 python2-pip                                     noarch                                     8.1.2-8.el7                                     epel                                     1.7 M

Transaction Summary
===========================================================================================================================================================================================
Install  1 Package

Total download size: 1.7 M
Installed size: 7.2 M
Is this ok [y/d/N]: y
Downloading packages:
python2-pip-8.1.2-8.el7.noarch.rpm                                                                                                                                  | 1.7 MB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : python2-pip-8.1.2-8.el7.noarch                                                                                                                                          1/1 
  Verifying  : python2-pip-8.1.2-8.el7.noarch                                                                                                                                          1/1 

Installed:
  python2-pip.noarch 0:8.1.2-8.el7                                                                                                                                                         

Complete!

#验证安装
pip -V
pip 8.1.2 from /usr/lib/python2.7/site-packages (python 2.7)

或者使用最新版;下载地址:https://pypi.org/project/pip/

Centos7 安装pip

安装:

tar xf pip-18.1.tar.gz
cd pip-18.1
python setup.py install

#报错:
Traceback (most recent call last):
  File "setup.py", line 6, in <module>
    from setuptools import find_packages, setup
ImportError: No module named setuptools

#解决:
wget http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg
sh setuptools-0.6c11-py2.7.egg

#再次执行安装:
python setup.py install

验证pip版本

pip --version
pip 18.1 from /usr/lib/python2.7/site-packages/pip-18.1-py2.7.egg/pip (python 2.7)

本文最后更新时间 2024-03-31
文章链接地址:
https://wojc.cn/archives/277.html
本站文章除注明[转载|引用],均为本站原创内容,转载前请注明出处
pip 安装错误 Command "python setup.py egg_info" failed with error code
python更换pip和easy_install源

借助wkhtmlpdf命令行工具发送微信图片告警

wkhtmltopdf - html转pdf/图片命令行工具

我要留言