求助:无法通过pip安装Django 2.0.2的问题
Hey there, let's work through why you're hitting this installation error!
First, let's recap the error you're seeing:
Could not find a version that satisfies the requirement Django==2.0 (from versions: 1.1.3, 1.1.4, 1.2, 1.2.1, 1.2.2, 1.2.3, 1.2.4, 1.2.5, 1.2.6, 1.2.7, 1.3, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.3.6, 1.3.7, 1.4, 1.4.1, 1.4.2, 1.4.3, 1.4.4, 1.4.5, 1.4.6, 1.4.7, 1.4.8...)
This almost always comes down to one of two key issues—let's fix them step by step:
Step 1: Check Your Python Version
Django 2.0.2 has strict Python compatibility rules: it only works with Python 3.4, 3.5, or 3.6. If you're still using Python 2.x, or a Python 3 version older than 3.4, pip will only show you Django versions that are compatible with your outdated Python setup.
Check your current Python version with this command:
python --version # Or for Python 3 specifically: python3 --version
If you're on an unsupported version, you'll need to upgrade Python first before installing Django 2.0.2.
Step 2: Upgrade Your Pip Version
Older versions of pip often can't recognize newer package releases on PyPI. That's probably why it's only listing those old Django versions! Update pip to the latest version using:
# For Python 2 environments pip install --upgrade pip # For Python 3 environments pip3 install --upgrade pip
Step 3: Reinstall Django 2.0.2
Once pip is updated, try running your install command again:
pip install Django==2.0.2 # Or use pip3 if you're targeting Python 3: pip3 install Django==2.0.2
Step 4: Verify the Installation
After the install finishes, double-check it worked by running:
python -m django --version # Or python3 -m django --version
You should see 2.0.2 printed out if everything went right!
内容的提问来源于stack exchange,提问作者Snipper03

