Python 和 Pip 不同步

标签 python linux python-2.7 pip

我正在使用预装了 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(感谢 the power of the __main__ module inside the package)。

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


或者,你可以运行

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

注意:请注意您正在运行的 pippython2:可能会有一个 /usr/bin/python和/usr/bin/pip在你安装的那些旁边/usr/local//usr/bin` 中的那些应该只在标准系统更新之后更新,如果有的话。

关于Python 和 Pip 不同步,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40035830/

相关文章:

linux - 如何在 rpm 规范文件中指定最低版本的 openssl 要求?

sql-server - [Microsoft][ODBC Driver 17 for SQL Server][SQL Server] 'abcdef' 附近的语法不正确。 (102) (SQLExecDirectW)")

python - 无法从 CLI 或 pyodbc 连接到 Mac 上 docker 容器中运行的 Mssql 服务器 - Azure DS 可以工作吗?

python - 无法弄清楚如何垂直打印 * 和空格而不是水平打印

c - 为什么一个程序的行为取决于它的 child 完成的顺序?

linux - 64 位内核模块在被 32 位客户端调用时崩溃

android - 带有kivy的android上的后退按钮功能

python - 清理多处理中的子进程

python - 使用DP解决 "Knapsack"

python - 网格置换算法 - 固定行顺序