Python2.7安装pip
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
更多推荐
所有评论(0)