如何在Windows上使用python 2.6安装pip [英] How to install pip with python 2.6 on Windows

查看:102
本文介绍了如何在Windows上使用python 2.6安装pip的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的开发机上使用python 2.6安装pip,以尝试匹配也使用python 2.6的部署环境.

Python 2.6安装成功.我已经尝试使用get-pip.py来安装pip,如此处 https://pip所述. pypa.io/en/stable/installing/ https://bootstrap.pypa.io/2.6/get-pip.py

但是它失败并显示以下内容:

C:\users\me> python get-pip.py
DEPRECATION: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of pip will drop support for Python 2.6
Collecting pip<10
c:\users\me\appdata\local\temp\tmpcdimtd\pip.zip\pip\_vendor\urllib3\util\ssl_.py:339: 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/advanced-usage.html#ssl-warnings
c:\users\me\appdata\local\temp\tmpcdimtd\pip.zip\pip\_vendor\urllib3\util\ssl_.py:137: 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
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '_ssl.c:490: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version'),)': /simple/pip/
c:\users\me\appdata\local\temp\tmpcdimtd\pip.zip\pip\_vendor\urllib3\util\ssl_.py:137: 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
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '_ssl.c:490: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version'),)': /simple/pip/
c:\users\me\appdata\local\temp\tmpcdimtd\pip.zip\pip\_vendor\urllib3\util\ssl_.py:137: 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
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '_ssl.c:490: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version'),)': /simple/pip/
c:\users\me\appdata\local\temp\tmpcdimtd\pip.zip\pip\_vendor\urllib3\util\ssl_.py:137: 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
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '_ssl.c:490: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version'),)': /simple/pip/
c:\users\me\appdata\local\temp\tmpcdimtd\pip.zip\pip\_vendor\urllib3\util\ssl_.py:137: 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
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '_ssl.c:490: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version'),)': /simple/pip/
c:\users\me\appdata\local\temp\tmpcdimtd\pip.zip\pip\_vendor\urllib3\util\ssl_.py:137: 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
  Could not fetch URL https://pypi.python.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.python.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLError(1, '_ssl.c:490: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version'),)) - skipping
  Could not find a version that satisfies the requirement pip<10 (from versions: )
No matching distribution found for pip<10

显然,升级到较新的python达不到我的目的.

建议将 URL 上的信息用于警告InsecurePlatformWarning建议我使用pip ...>安装更多的东西.

PS 我也尝试过使用setuptools-40.0.0中的简易安装,但是无法正常工作.我不确定我是否正确使用它,因为setuptools安装文档具有循环链接(从文档到Pypi,再到文档)

解决方案

对于Python 2.6,您需要较旧的setuptools.适用于Python 2.6的最新setuptools版本是 36.8

下载 setuptools-36.8.0.zip ,解压缩并运行python2.6 setup.py install.

之后 get-pip.py 应该为您安装pip.

pip的最新版本支持Python 2.6是 9.0.3 : https://pypi.org/project/pip/9.0.3/#files

Im attempting to install pip with python 2.6 on my dev machine to try to match a deployment environment that also uses python 2.6.

Python 2.6 is installed OK. I've tried installing pip using get-pip.py as outlined here https://pip.pypa.io/en/stable/installing/ with the version of the get-pip.py script from https://bootstrap.pypa.io/2.6/get-pip.py

However it fails with the following:

C:\users\me> python get-pip.py
DEPRECATION: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of pip will drop support for Python 2.6
Collecting pip<10
c:\users\me\appdata\local\temp\tmpcdimtd\pip.zip\pip\_vendor\urllib3\util\ssl_.py:339: 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/advanced-usage.html#ssl-warnings
c:\users\me\appdata\local\temp\tmpcdimtd\pip.zip\pip\_vendor\urllib3\util\ssl_.py:137: 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
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '_ssl.c:490: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version'),)': /simple/pip/
c:\users\me\appdata\local\temp\tmpcdimtd\pip.zip\pip\_vendor\urllib3\util\ssl_.py:137: 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
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '_ssl.c:490: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version'),)': /simple/pip/
c:\users\me\appdata\local\temp\tmpcdimtd\pip.zip\pip\_vendor\urllib3\util\ssl_.py:137: 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
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '_ssl.c:490: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version'),)': /simple/pip/
c:\users\me\appdata\local\temp\tmpcdimtd\pip.zip\pip\_vendor\urllib3\util\ssl_.py:137: 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
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '_ssl.c:490: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version'),)': /simple/pip/
c:\users\me\appdata\local\temp\tmpcdimtd\pip.zip\pip\_vendor\urllib3\util\ssl_.py:137: 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
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '_ssl.c:490: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version'),)': /simple/pip/
c:\users\me\appdata\local\temp\tmpcdimtd\pip.zip\pip\_vendor\urllib3\util\ssl_.py:137: 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
  Could not fetch URL https://pypi.python.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.python.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLError(1, '_ssl.c:490: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version'),)) - skipping
  Could not find a version that satisfies the requirement pip<10 (from versions: )
No matching distribution found for pip<10

Obviously, upgrading to newer python defeats my purpose.

The information at the URL recommended for the warning InsecurePlatformWarning suggests that I install more things using pip... >.<

PS I've tried using easy-install from setuptools-40.0.0 as well, but I could not get this to work. I'm not sure if I'm using it correctly as the setuptools installation documentation has circular links (from the documentation to Pypi, back to the documentation)

解决方案

For Python 2.6 you need older setuptools. The last setuptools version that works with Python 2.6 is 36.8.

Download setuptools-36.8.0.zip, unpack and run python2.6 setup.py install.

After that get-pip.py should install pip for you.

The last version of pip supporting Python 2.6 is 9.0.3: https://pypi.org/project/pip/9.0.3/#files

这篇关于如何在Windows上使用python 2.6安装pip的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆