pip 是一个Python包管理工具,主要是用于安装 PyPI 上的软件包,可以替代 easy_install 工具。
2.1 脚本安装pip
下载文件:
wget https://bootstrap.pypa.io/get-pip.py
执行结果:
[root@node1 python_lib]# wget https://bootstrap.pypa.io/get-pip.py
--2017-11-10 22:43:23-- https://bootstrap.pypa.io/get-pip.py
正在解析主机 bootstrap.pypa.io... 151.101.72.175
正在连接 bootstrap.pypa.io|151.101.72.175|:443... 已连接。
错误: 证书通用名 “*.c.ssl.fastly.net” 与所要求的主机名 “bootstrap.pypa.io” 不符。
要以不安全的方式连接至 bootstrap.pypa.io,使用‘--no-check-certificate’。
wget https://bootstrap.pypa.io/get-pip.py --no-check-certificate
......
......
下载成功了,开始安装
[root@node1 python_lib]# python get-pip.py
DEPRECATION: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of pip will drop support for Python 2.6
Collecting pip
/tmp/tmpmjaBRb/pip.zip/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning.
/tmp/tmpmjaBRb/pip.zip/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB)
100% |████████████████████████████████| 1.3MB 25kB/s
Collecting wheel
Downloading wheel-0.30.0-py2.py3-none-any.whl (49kB)
100% |████████████████████████████████| 51kB 25kB/s
Installing collected packages: pip, wheel
Successfully installed pip-9.0.1 wheel-0.30.0
/tmp/tmpmjaBRb/pip.zip/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
[root@node1 python_lib]# python get-pip.py
DEPRECATION: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of pip will drop support for Python 2.6
Collecting pip
/tmp/tmpmjaBRb/pip.zip/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning.
/tmp/tmpmjaBRb/pip.zip/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB)
100% |████████████████████████████████| 1.3MB 25kB/s
Collecting wheel
Downloading wheel-0.30.0-py2.py3-none-any.whl (49kB)
100% |████████████████████████████████| 51kB 25kB/s
Installing collected packages: pip, wheel
Successfully installed pip-9.0.1 wheel-0.30.0
/tmp/tmpmjaBRb/pip.zip/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
2.2 检查安装结果
[root@node1 python_lib]# pip -version
Usage:
pip [options]
no such option: -e
[root@node1 python_lib]#
执行 pip -version 如果出现了上面的提示,证明安装成功,这里虽然看起来是是安装成功了,但是上面有一个很重要的提示:
DEPRECATION: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of pip will drop support for Python 2.6
翻译之后就是:
Python核心团队不再支持Python 2.6,请升级您的Python。 未来版本的pip将会放弃对Python 2.6的支持,看来这个安装其实是不能用的,因为目前用的是python2.6.6,所以接下来是把python升级到2.7