Pyenv无法安装Python2.7.7-在最后一步失败尝试安装PIP
我正在尝试使用OS Monterey 12.3.1在MacBook上安装Python2.7,并具有以下命令:
$ export LDFLAGS="-L/usr/local/opt/zlib/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/sqlite/lib"
$ export CPPFLAGS="-I/usr/local/opt/zlib/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include"
$ pyenv install 2.7.7
Python2的安装似乎与PIP的安装相结合。当Pyenv试图安装PIP时,pyenv install
命令在以下输出中失败:
$ pyenv install 2.7.7
Downloading openssl-1.0.2k.tar.gz...
-> https://pyenv.github.io/pythons/6b3977c61f2aedf0f96367dcfb5c6e578cf37e7b8d913b4ecb6643c3cb88d8c0
Installing openssl-1.0.2k...
Installed openssl-1.0.2k to ~/.pyenv/versions/2.7.7
python-build: use readline from homebrew
Downloading Python-2.7.7.tar.xz...
-> https://www.python.org/ftp/python/2.7.7/Python-2.7.7.tar.xz
Installing Python-2.7.7...
patching file ./Lib/site.py
patching file ./Lib/ssl.py
patching file ./Modules/_ssl.c
python-build: use tcl-tk from homebrew
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
WARNING: The Python bz2 extension was not compiled. Missing the bzip2 lib?
Installing pip from https://bootstrap.pypa.io/pip/2.7/get-pip.py...
error: failed to install pip via get-pip.py
BUILD FAILED (OS X 12.3.1 using python-build 20180424)
Inspect or clean up the working tree at /var/folders/wr/zfs3tyhj67366bgn7ftymcs80000gn/T/python-build.20220422123040.23748
Results logged to /var/folders/wr/zfs3tyhj67366bgn7ftymcs80000gn/T/python-build.20220422123040.23748.log
最后10个日志行:
WARNING: Certificate did not match expected hostname: pypi.org. Certificate: {'notAfter': 'Nov 23 18:41:10 2022 GMT', 'subjectAltName': (('DNS', 'www.python.org'), ('DNS', '*.python.org'), ('DNS', 'docs.python.org'), ('DNS', 'downloads.python.org'), ('DNS', 'pypi.python.org')), 'subject': ((('commonName', u'www.python.org'),),)}
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(CertificateError("hostname 'pypi.org' doesn't match either of 'www.python.org', '*.python.org', 'docs.python.org', 'downloads.python.org', 'pypi.python.org'",),)': /simple/pip/
/var/folders/wr/zfs3tyhj67366bgn7ftymcs80000gn/T/tmptKInSX/pip.zip/pip/_vendor/urllib3/util/ssl_.py:164: 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/advanced-usage.html#ssl-warnings
WARNING: Certificate did not match expected hostname: pypi.org. Certificate: {'notAfter': 'Nov 23 18:41:10 2022 GMT', 'subjectAltName': (('DNS', 'www.python.org'), ('DNS', '*.python.org'), ('DNS', 'docs.python.org'), ('DNS', 'downloads.python.org'), ('DNS', 'pypi.python.org')), 'subject': ((('commonName', u'www.python.org'),),)}
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(CertificateError("hostname 'pypi.org' doesn't match either of 'www.python.org', '*.python.org', 'docs.python.org', 'downloads.python.org', 'pypi.python.org'",),)': /simple/pip/
/var/folders/wr/zfs3tyhj67366bgn7ftymcs80000gn/T/tmptKInSX/pip.zip/pip/_vendor/urllib3/util/ssl_.py:164: 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/advanced-usage.html#ssl-warnings
WARNING: Certificate did not match expected hostname: pypi.org. Certificate: {'notAfter': 'Nov 23 18:41:10 2022 GMT', 'subjectAltName': (('DNS', 'www.python.org'), ('DNS', '*.python.org'), ('DNS', 'docs.python.org'), ('DNS', 'downloads.python.org'), ('DNS', 'pypi.python.org')), 'subject': ((('commonName', u'www.python.org'),),)}
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(CertificateError("hostname 'pypi.org' doesn't match either of 'www.python.org', '*.python.org', 'docs.python.org', 'downloads.python.org', 'pypi.python.org'",),)) - skipping
ERROR: Could not find a version that satisfies the requirement pip<21.0 (from versions: none)
ERROR: No matching distribution found for pip<21.0
似乎一切都在起作用,但是pypi.org的root证书不信任,什么都不是'这很有意义,因为我可以在浏览器中查看证书,并且表明它是值得信赖的。
我无法理解什么?如何让Pyenv完成Python2.7.7和PIP的安装?
I'm trying to install python2.7 on my MacBook with OS Monterey 12.3.1 with the following command:
$ export LDFLAGS="-L/usr/local/opt/zlib/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/sqlite/lib"
$ export CPPFLAGS="-I/usr/local/opt/zlib/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include"
$ pyenv install 2.7.7
The installation of python2 seems to be coupled with the installation of pip. When pyenv is attempting to install pip the pyenv install
command fails with the following output:
$ pyenv install 2.7.7
Downloading openssl-1.0.2k.tar.gz...
-> https://pyenv.github.io/pythons/6b3977c61f2aedf0f96367dcfb5c6e578cf37e7b8d913b4ecb6643c3cb88d8c0
Installing openssl-1.0.2k...
Installed openssl-1.0.2k to ~/.pyenv/versions/2.7.7
python-build: use readline from homebrew
Downloading Python-2.7.7.tar.xz...
-> https://www.python.org/ftp/python/2.7.7/Python-2.7.7.tar.xz
Installing Python-2.7.7...
patching file ./Lib/site.py
patching file ./Lib/ssl.py
patching file ./Modules/_ssl.c
python-build: use tcl-tk from homebrew
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
WARNING: The Python bz2 extension was not compiled. Missing the bzip2 lib?
Installing pip from https://bootstrap.pypa.io/pip/2.7/get-pip.py...
error: failed to install pip via get-pip.py
BUILD FAILED (OS X 12.3.1 using python-build 20180424)
Inspect or clean up the working tree at /var/folders/wr/zfs3tyhj67366bgn7ftymcs80000gn/T/python-build.20220422123040.23748
Results logged to /var/folders/wr/zfs3tyhj67366bgn7ftymcs80000gn/T/python-build.20220422123040.23748.log
Last 10 log lines:
WARNING: Certificate did not match expected hostname: pypi.org. Certificate: {'notAfter': 'Nov 23 18:41:10 2022 GMT', 'subjectAltName': (('DNS', 'www.python.org'), ('DNS', '*.python.org'), ('DNS', 'docs.python.org'), ('DNS', 'downloads.python.org'), ('DNS', 'pypi.python.org')), 'subject': ((('commonName', u'www.python.org'),),)}
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(CertificateError("hostname 'pypi.org' doesn't match either of 'www.python.org', '*.python.org', 'docs.python.org', 'downloads.python.org', 'pypi.python.org'",),)': /simple/pip/
/var/folders/wr/zfs3tyhj67366bgn7ftymcs80000gn/T/tmptKInSX/pip.zip/pip/_vendor/urllib3/util/ssl_.py:164: 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/advanced-usage.html#ssl-warnings
WARNING: Certificate did not match expected hostname: pypi.org. Certificate: {'notAfter': 'Nov 23 18:41:10 2022 GMT', 'subjectAltName': (('DNS', 'www.python.org'), ('DNS', '*.python.org'), ('DNS', 'docs.python.org'), ('DNS', 'downloads.python.org'), ('DNS', 'pypi.python.org')), 'subject': ((('commonName', u'www.python.org'),),)}
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(CertificateError("hostname 'pypi.org' doesn't match either of 'www.python.org', '*.python.org', 'docs.python.org', 'downloads.python.org', 'pypi.python.org'",),)': /simple/pip/
/var/folders/wr/zfs3tyhj67366bgn7ftymcs80000gn/T/tmptKInSX/pip.zip/pip/_vendor/urllib3/util/ssl_.py:164: 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/advanced-usage.html#ssl-warnings
WARNING: Certificate did not match expected hostname: pypi.org. Certificate: {'notAfter': 'Nov 23 18:41:10 2022 GMT', 'subjectAltName': (('DNS', 'www.python.org'), ('DNS', '*.python.org'), ('DNS', 'docs.python.org'), ('DNS', 'downloads.python.org'), ('DNS', 'pypi.python.org')), 'subject': ((('commonName', u'www.python.org'),),)}
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(CertificateError("hostname 'pypi.org' doesn't match either of 'www.python.org', '*.python.org', 'docs.python.org', 'downloads.python.org', 'pypi.python.org'",),)) - skipping
ERROR: Could not find a version that satisfies the requirement pip<21.0 (from versions: none)
ERROR: No matching distribution found for pip<21.0
It seems that everything is working but the root certificate of pypi.org isn't trusted which doesn't make sense because I can view the cert in my browser and it shows that it is trusted.
What am I failing to understand and how can I get pyenv to complete the installation of python2.7.7 and pip?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论