Linux自带Python2.7,没有pip安装工具,所以要先安装pip

先安装setuptools

[root@localhost local]# wget https://pypi.python.org/packages/source/s/setuptools/setuptools-2.0.tar.gz --no-check-certificate
[root@localhost local]# tar zxvf setuptools-2.0.tar.gz
[root@localhost local]# cd setuptools-2.0/
[root@localhost setuptools-2.0]# ls
CHANGES (links).txt DEVGUIDE.txt ez_setup.py _markerlib README.txt setup.py tests
CHANGES.txt docs launcher.c PKG-INFO release.py setuptools
CONTRIBUTORS.txt easy_install.py MANIFEST.in pkg1_resources.py setup.cfg setuptools.egg-info
[root@localhost setuptools-2.0]# python setup.py build
[root@localhost setuptools-2.0]# python setup.py install在这里插入图片描述

安装pip

在官网下载
https://pypi.org/project/pip/#files在这里插入图片描述
[root@localhost ~]# wget https://files.pythonhosted.org/packages/08/25/f204a6138dade2f6757b4ae99bc3994aac28a5602c97ddb2a35e0e22fbc4/pip-20.1.1.tar.gz
[root@localhost ~]# tar xf pip-20.1.1.tar.gz -C /usr/local/
[root@localhost ~]# cd /usr/local/
[root@localhost local]# cd pip-20.1.1/
[root@localhost pip-20.1.1]# ls
AUTHORS.txt LICENSE.txt NEWS.rst pyproject.toml setup.cfg src
docs MANIFEST.in PKG-INFO README.rst setup.py
[root@localhost pip-20.1.1]# python setup.py install在这里插入图片描述

测试

[root@localhost pip-20.1.1]# pip -V
pip 20.1.1 from /usr/lib/python2.7/site-packages/pip-20.1.1-py2.7.egg/pip (python 2.7)

出现的问题

如果不先安装setuptools会报错
[root@localhost pip-20.1.1]# python setup.py install
Traceback (most recent call last):
File “setup.py”, line 8, in
from setuptools import find_packages, setup
ImportError: No module named setuptools
因为pip的安装文件中会调用setuptools
from setuptools import find_packages, setup

GitHub 加速计划 / li / linux-dash
10.39 K
1.2 K
下载
A beautiful web dashboard for Linux
最近提交(Master分支:2 个月前 )
186a802e added ecosystem file for PM2 4 年前
5def40a3 Add host customization support for the NodeJS version 4 年前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐