Python 使用 get_pip.py SNIMissingWarning 安装 pip
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/35535566/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
installing pip using get_pip.py SNIMissingWarning
提问by Cobry
I am trying to install pip on my Mac Yosemite 10.10.5using get_pip.py file but I am having the following issue
我正在尝试使用 get_pip.py 文件在我的 Mac Yosemite 10.10.5 上安装 pip,但我遇到了以下问题
Bachirs-MacBook-Pro:Downloads bachiraoun$ sudo python get-pip.py
The directory '/Users/bachiraoun/Library/Caches/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 '/Users/bachiraoun/Library/Caches/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.
Collecting pip
/tmp/tmpOofplD/pip.zip/pip/_vendor/requests/packages/urllib3/util/ssl_.py:315: 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. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
/tmp/tmpOofplD/pip.zip/pip/_vendor/requests/packages/urllib3/util/ssl_.py:120: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
Could not fetch URL https://pypi.python.org/simple/pip/: There was a problem confirming the ssl certificate: [Errno 1] _ssl.c:510: error:0D0890A1:asn1 encoding routines:ASN1_verify:unknown message digest algorithm - skipping
Could not find a version that satisfies the requirement pip (from versions: )
No matching distribution found for pip
According to the my error message and urllib3my problem is because I have a python installation version earlier than earlier than 2.7.9 but my python is 2.7.10 as you can see
根据我的错误消息和urllib3我的问题是因为我的 python 安装版本早于 2.7.9 但我的 python 是 2.7.10,如您所见
Bachirs-MacBook-Pro:docs bachiraoun$ python
Python 2.7.10 (default, Jul 14 2015, 19:46:27)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.version_info
sys.version_info(major=2, minor=7, micro=10, releaselevel='final', serial=0)
>>>
I verified my openssl installed and it seems to be ok
我验证了我安装的 openssl 似乎没问题
Bachirs-MacBook-Pro:docs bachiraoun$ brew install openssl
Warning: openssl-1.0.2f already installed
not sure how to fix this, any idea ?
不知道如何解决这个问题,知道吗?
回答by Lajos Arpad
You have a problem with folder privileges. The folder of
您的文件夹权限有问题。的文件夹
/Users/ME/Library/Caches/pip/http
or one of its ancestors is not owned by the user with which you intend to interact with them. You need to check which user you are trying to do this and you need to make sure that the given user has the necessary permissions for all the folders in the path.
或其祖先之一不属于您打算与之交互的用户。您需要检查您正在尝试执行此操作的用户,并且您需要确保给定的用户对路径中的所有文件夹具有必要的权限。
回答by Koga
Directory Permission Issue
目录权限问题
Lines one and two of the output say that there is an issue with the folder's privileges. You can see if you need to change the permissions by doing ls -a /Users/ME/Library
and checking if the permissions are equal to drwx------+
. If they aren't you can resolve the problem by using chmod to change the permissions: chmod 700 /Users/ME/Library
.
输出的第一行和第二行表示文件夹的权限存在问题。您可以通过执行ls -a /Users/ME/Library
并检查权限是否等于 来查看是否需要更改权限drwx------+
。如果不是,您可以通过使用 chmod 更改权限来解决问题:chmod 700 /Users/ME/Library
.
However seeing as the first execution line (Bachirs-MacBook-Pro:Downloads ME$
) has the ME$
as the prefix you shouldn't have this problem as it indicates . You are also running get_pip.py
as root so permissions should not be an obstacle. The problem becomes clearer when you view the second execution line (Bachirs-MacBook-Pro:Downloads bachiraoun$
), it seems that the script is being executed as bachiraoun
as opposed to ME
which would explain why there was the error that there was. I presume that you entered the shell in an abnormal way as it shouldn't change like that. Could you give more details in how you entered the shell and could you rerun the script?
但是,由于第一个执行行 ( Bachirs-MacBook-Pro:Downloads ME$
) 具有ME$
前缀,因此您不应该遇到此问题,因为它表明 . 您还get_pip.py
以 root 身份运行,因此权限不应成为障碍。当您查看第二个执行行 ( Bachirs-MacBook-Pro:Downloads bachiraoun$
) 时,问题变得更加清晰,似乎脚本正在执行,bachiraoun
而不是ME
解释为什么会出现错误。我认为您以不正常的方式进入了 shell,因为它不应该像那样改变。您能否提供有关如何进入 shell 的更多详细信息,并重新运行脚本?
SSL
安全证书
In the unlikely event that permissions was not the problem this may be it. The fourth-last line seems to suggest that there was a problem regarding the ssl. If you have homebrew installed you can do brew install openssl
. Note the lack of sudo as homebrew doesn't play well with it. After that try running the script again. Again it it most likely a permissions error and you should try to resolve that first.
万一权限不是问题,这可能就是问题。倒数第四行似乎表明 ssl 存在问题。如果您安装了自制软件,则可以执行brew install openssl
. 请注意缺少 sudo 因为自制软件不能很好地使用它。之后尝试再次运行脚本。同样,它很可能是权限错误,您应该首先尝试解决该问题。
回答by lbsweek
need install:
需要安装:
pip install pyopenssl ndg-httpsclient pyasn1
link: http://urllib3.readthedocs.org/en/latest/security.html#openssl-pyopenssl
链接:http: //urllib3.readthedocs.org/en/latest/security.html#openssl-pyopenssl
By default, we use the standard library's ssl module. Unfortunately, there are several limitations which are addressed by PyOpenSSL:
默认情况下,我们使用标准库的 ssl 模块。不幸的是,PyOpenSSL 解决了几个限制:
(Python 2.x) SNI support. (Python 2.x-3.2) Disabling compression to mitigate CRIME attack.
(Python 2.x) SNI 支持。(Python 2.x-3.2) 禁用压缩以减轻 CRIME 攻击。
To use the Python OpenSSL bindings instead, you'll need to install the required packages:
要改用 Python OpenSSL 绑定,您需要安装所需的软件包:
pip install pyopenssl ndg-httpsclient pyasn1