繁体   English   中英

Python 和 Pip 不同步

[英]Python and Pip not in sync

我正在使用预安装了 python 2.7.6 的远程 linux 服务器。 我想升级到 python 2.7.12 (因为由于下面显示的一些ssl 错误,我无法在 2.7.6 上安装一些库)。

我从源代码下载并编译并安装了 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

以这种方式升级(并自动重新安装)pip:

/path/to/python2.7.12 -m pip install pip --upgrade

-m标志加载相应的模块,在 pip 的情况下将执行pip (感谢包内__main__模块的强大功能)。

安装后,您当前的pip也应该是最新的。


或者,你可以运行

/path/to/python2.7.12 /path/to/pip2 install pip --upgrade

注意:请注意您正在运行的pippython2 :在next to the ones you installed in /usr/local/ 的next to the ones you installed in可能会有一个/usr/bin/python和 /usr/bin/pip . The ones in /usr/bin` 中. The ones in应该在标准系统更新之后更新,如果有的话。

谢谢@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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM