MacOS系统下PIP故障排查:安装boto3时下载报错
Hey Joe, sorry to hear you're hitting snags installing boto3. From the partial output you shared, it looks like the download gets started but chokes up when pulling in the botocore dependency—super common issue, let's walk through some fixes that usually resolve this:
First, let's recap what you're seeing for context:
Collecting boto3
Downloading boto3-1.6.11-py2.py3-none-any.whl (128kB)
100% |████████████████████████████████| 133kB 2.7MB/s
Requirement already satisfied: jmespath<1.0.0,>=0.7.1 in /Library/Python/2.7/site-packages (from boto3)
Collecting botocore<1.10.0,>=1.9.11 (from boto3)
Downloading botocore-1.9.11-py2.py3-none-any.whl (4.1MB)
100% |████████████████████████████████| ...
Common Fixes to Try:
Fix network interruptions or use a reliable PyPI mirror
Sometimes flaky internet cuts off large downloads like botocore. Try switching to a trusted, region-specific PyPI mirror (many regions have local mirrors that improve download speed and reliability) by adding the-iflag followed by the mirror's URL to your install command. If you're on a corporate network, also check if a proxy is blocking the download—you might need to configure pip with proxy settings.Clear pip's corrupted cache
Pip stores cached packages locally, and if a cached file gets corrupted, it can cause partial download failures. Purge the cache first, then retry the installation:pip cache purge pip install boto3Use a virtual environment instead of system Python
It looks like you're using Python 2.7's system-wide site-packages, which can run into permission issues or dependency conflicts with other installed packages. Create a virtual environment to isolate your boto3 installation:# Install virtualenv (required for Python 2.7) pip install virtualenv # Create a new virtual environment virtualenv my_boto_env # Activate the environment (macOS/Linux) source my_boto_env/bin/activate # For Windows, use: my_boto_env\Scripts\activate # Now install boto3 in the isolated environment pip install boto3Upgrade pip first
Older pip versions have bugs with large file downloads and dependency resolution. Upgrade pip to the latest version compatible with Python 2.7, then install boto3:pip install --upgrade pip==20.3.4 # This is the last pip version supporting Python 2.7 pip install boto3Specify a newer (but compatible) boto3 version
The version you're trying to install (1.6.11) is quite outdated—there might be compatibility issues with your system. Try installing the most recent boto3 version that still supports Python 2.7:pip install boto3==1.17.106 # Last boto3 version compatible with Python 2.7
If none of these fixes work, sharing the full error message (the part that follows the partial download bar) would help narrow down the exact issue further.
内容的提问来源于stack exchange,提问作者Joe

