使用Python 2.7.14通过pip安装geopandas时出现egg_info错误码1问题
Hey there, let’s work through this annoying error you’re hitting when trying to install geopandas on Python 2.7.14. That python setup.py egg_info failure is almost always tied to either outdated packaging tools or incompatible dependency versions—and since Python 2.7 reached end-of-life years ago, geopandas has dropped official support for it. But don’t worry, we can still get it up and running with a few targeted steps.
Step 1: Upgrade pip and setuptools to their last Python 2.7-compatible versions
Older versions of pip and setuptools often cause egg_info errors because they don’t handle modern package metadata correctly. Run these commands to get the newest versions that still support Python 2.7:
pip install --upgrade pip==20.3.4 pip install --upgrade setuptools==44.1.1
Step 2: Install compatible versions of geopandas’ dependencies
Geopandas relies on libraries like Shapely, Fiona, PyProj, and Pandas—all of which have stopped supporting Python 2.7 in newer releases. Install these specific versions first:
pip install shapely==1.6.4.post2 pip install fiona==1.8.20 pip install pyproj==1.9.6 pip install pandas==0.24.2
Each of these is the final version of that library that works with Python 2.7, so they’ll play nicely together.
Step 3: Install the last Python 2.7-compatible geopandas release
Now that all dependencies are in place, install the final version of geopandas that supports Python 2.7:
pip install geopandas==0.8.2
Troubleshooting: Missing system libraries
If you still hit errors, you might be missing system-level libraries that the Python packages rely on. For example:
- On Ubuntu/Debian-based Linux systems, run this to install required system packages:
sudo apt-get install libgdal-dev libgeos-dev libproj-dev - On Windows, look for pre-compiled binary wheels for the dependency packages (like Fiona and Shapely) that are built for Python 2.7. You can install these local files directly with
pip install /path/to/wheel-file.whl.
内容的提问来源于stack exchange,提问作者peter

