python - 无法在虚拟环境中升级 PIP

标签 python linux ubuntu pip

我正在尝试在虚拟环境中升级 pip。我在 ubuntu 14.04 机器上使用 venvburrito 包装器。当我尝试更新它时,出现以下错误:

   (virtual_env) ubuntu@ip-xxxxxxx:~$ pip install pip --upgrade
Collecting pip
  Using cached pip-9.0.1-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 8.1.2
    Not uninstalling pip at /home/ubuntu/.venvburrito/lib/python2.7/site-packages/pip-8.1.2-py2.7.egg, outside environment /home/ubuntu/.virtualenvs/virtual_env
Successfully installed pip-8.1.2
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

如果我在虚拟环境中尝试使用 sudo,我会收到以下错误:

(virtual_env) ubuntu@ip-xxxxxxx:~$ sudo pip install --upgrade pip
The directory '/home/ubuntu/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/ubuntu/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
/home/ubuntu/.local/lib/python2.7/site-packages/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.
  SNIMissingWarning
/home/ubuntu/.local/lib/python2.7/site-packages/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.
  InsecurePlatformWarning
Requirement already up-to-date: pip in ./.local/lib/python2.7/site-packages
/home/ubuntu/.local/lib/python2.7/site-packages/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.
  InsecurePlatformWarning

当我在虚拟环境之外执行此操作时,它会正确安装。

任何帮助将不胜感激。

谢谢

最佳答案

试试这个,它对我有用。

(inside virtualenv):easy_install -U pip

(inside virtualenv):easy_install pip

关于python - 无法在虚拟环境中升级 PIP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42529975/

相关文章:

python - 从 IDLE 打印 unicode 子类实例时打印永远阻塞

java - 从 Java 应用程序打印到 TSC 打印机

node.js - "Ionic start projectName"不适用于 Ionic Framework

swift - 在 ubuntu 14.04 中快速安装时出错

python flask 导入错误

Python:创建用于流式写入的压缩 tar 文件

python - 如何从shell中不同目录的python脚本调用函数

c - 从 stdin 查找文件的大小给出了错误的数字

linux - 部署独立的 native OCaml 应用程序

macos - 从 mac 到 ubuntu 的 ssh 转发不起作用