我正在安装预装了python 2.7.6的远程linux服务器。我想升级到python 2.7.12 (因为我无法在2.7.6上安装一些库,因为下面显示了一些 ssl错误)。
我从源代码下载并编译并安装了2.7.12并且python2.7
打开了2.7.12。但是,在使用pip时,我仍然会收到更新python版本警告。似乎pip没有与2.7.12同步并且继续服务于2.7.6并且我无法在系统中找到其他pip安装。
我只想要一个python2.7.x的工作版本,pip / pip2 / pip2.7正常工作。
/usr/local/lib/python2.7/dist-packages/pip-8.1.2-py2.7.egg/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.org/en/latest/security.html#snimissingwarning.
SNIMissingWarning
/usr/local/lib/python2.7/dist-packages/pip-8.1.2-py2.7.egg/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.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
答案 0 :(得分:1)
以这种方式升级(并自动重新安装):
/path/to/python2.7.12 -m pip install pip --upgrade
-m
标志加载相应的模块,在pip的情况下将执行pip
(感谢the power of the __main__
module inside the package)。
安装后,您当前的pip
也应该是最新的。
或者,您可以运行
/path/to/python2.7.12 /path/to/pip2 install pip --upgrade
注意:警惕您正在运行的pip
和python2
:其中可能是/usr/bin/python
和/ usr / bin / pip {{1应该在标准系统更新后更新/ usr / local / next to the ones you installed in
/ usr / bin`,如果有的话。
答案 1 :(得分:0)
感谢@Evert,在我尝试解决您的解决方案之前,
curl -O https://bootstrap.pypa.io/get-pip.py
python27 get-pip.py
这解决了我的问题,我可以使用2.7.12
pip/pip2.7
我之前尝试python2.7 -m pip install package-name
而我正在pip not found
。