Windows 7.0下安装Python 2.x pip及setuptools失败求助
Hey there! Let's work through getting pip and setuptools installed for your Python 2.6.6 64-bit setup on Windows. Since Python 2.6 is a pretty legacy version at this point, the modern installation methods won't cut it—we need to use approaches tailored specifically to older releases.
Step 1: Grab the Right Legacy Install Packages
Python 2.6 is no longer supported by the latest pip/setuptools builds, so you need to download versions that are compatible:
- For setuptools: Look for the
.eggfile made for Python 2.6 (likesetuptools-0.6c11-py2.6.egg—this is the final release that works with Python 2.6) - For pip: You'll need
pip-1.1, the last version that supports Python 2.6 (you can grab it as a.tar.gzarchive)
Step 2: Install setuptools via the Egg File
- Fire up your admin PowerShell and navigate to the folder where you saved the setuptools egg file.
- Run this command (replace the filename with whatever you downloaded):
This should installpython .\setuptools-0.6c11-py2.6.eggeasy_installdirectly into your Python 2.6Scriptsfolder.
Step 3: Fix Path Issues (If Needed)
If running easy_install --version throws an error saying the command isn't found, add your Python 2.6 Scripts directory to your PowerShell path temporarily:
$env:PATH += ";C:\Python26\Scripts"
For a permanent fix, you can add this path via System Properties > Advanced > Environment Variables.
Step 4: Install Pip Using easy_install
Now that easy_install is working, use it to install the compatible pip version:
easy_install pip==1.1
This ensures you get a version that plays nice with Python 2.6.
Step 5: Verify Everything Works
Run these commands to confirm both tools are installed correctly:
easy_install --version pip --version
Quick Notes to Avoid Headaches
- Skip modern install scripts: The standard
get-pip.pystopped supporting Python 2.6 years ago—using it will just throw errors. - Stick to 64-bit: If you have both 32-bit and 64-bit Python installed, use the full path
C:\Python26\python.exeinstead of justpythonto avoid mixing architectures. - Keep using admin mode: Installing to the system Python directory still requires elevated permissions, so don't drop that admin PowerShell.
内容的提问来源于stack exchange,提问作者Vynylyn

