ArcGIS自带Python 2.7安装pip失败求助:执行get-pip.py遇版本匹配错误
Hey there, I’ve run into this exact issue before with ArcGIS’s bundled Python 2.7—let’s break down why it’s happening and how to fix it.
Why You’re Seeing This Error
Python 2.7 reached its end-of-life back in 2020, and modern versions of pip no longer support it. The standard get-pip.py you downloaded tries to install the latest pip release, which isn’t compatible with Python 2.7. That’s exactly why you’re getting that frustrating "no matching distribution found" message.
Step-by-Step Solution
Here’s how to install the last version of pip that works with Python 2.7 (version 20.3.4):
Open Command Prompt as Administrator
- Right-click the Command Prompt shortcut in Start > Accessories, then select "Run as administrator." This avoids permission errors that can pop up during installation.
Navigate to ArcGIS’s Python Directory
Run this command to switch to your ArcGIS Python folder:cd C:\Python27\ArcGIS10.2Get the Compatible Bootstrap Script
You’ll need a version ofget-pip.pythat’s designed specifically for Python 2.7 (the generic one you downloaded won’t work). Search for "pip 2.7 legacy bootstrap script" to find the correct official file, then save it directly into yourC:\Python27\ArcGIS10.2\directory.Run the Installation
Execute this command to install the compatible pip version:python get-pip.pyThis script will automatically install pip 20.3.4, which plays nicely with ArcGIS’s Python 2.7.
Verify the Installation
To make sure everything worked, run:pip --versionYou should see output like
pip 20.3.4 from C:\Python27\ArcGIS10.2\Lib\site-packages\pip (python 2.7).
Troubleshooting Tips
- If you run into network issues (like slow downloads or blocked access), try using a domestic PyPI mirror by adding this flag to the installation command:
python get-pip.py -i https://pypi.tuna.tsinghua.edu.cn/simple - Double-check that you’re using the right Python executable—if you have multiple Python versions installed, running
python --versionshould confirm it’s Python 2.7.x (matching ArcGIS 10.2’s version).
内容的提问来源于stack exchange,提问作者Yanglan Wang

