MacOS HighSierra下pip安装Qiskit报错:找不到qiskit.egg-info文件
Hey there! Sorry to hear you're stuck trying to install Qiskit using pip—those red error lines (marked with *) are definitely frustrating, but let's work through the most common fixes to get you up and running.
Common Troubleshooting Steps
1. Upgrade Pip First
Outdated pip versions often cause compatibility issues with newer packages. Run this command to make sure you're on the latest pip:
python -m pip install --upgrade pip
Note: If you use python3 to call Python on your system, replace python with python3 in all commands below.
2. Switch to a Reliable Package Mirror
Network issues or slow official PyPI servers can lead to installation failures. If you're in a region with limited access to PyPI, try using a domestic mirror (like the Tsinghua mirror for Chinese users):
pip install qiskit -i https://pypi.tuna.tsinghua.edu.cn/simple
3. Use a Virtual Environment to Avoid Dependency Conflicts
Existing packages on your system might clash with Qiskit's dependencies. Creating an isolated virtual environment can solve this:
- Create the environment:
python -m venv qiskit-env - Activate it:
- Windows:
qiskit-env\Scripts\activate - Mac/Linux:
source qiskit-env/bin/activate
- Windows:
- Now install Qiskit in this clean environment:
pip install qiskit
4. Verify Your Python Version
Qiskit has strict Python version requirements (usually 3.8 to 3.11 for recent releases). Check your version with:
python --version
If your version is outside this range, upgrade or downgrade Python to a compatible version before trying again.
5. Clear Pip's Cache
Corrupted cache files can break installations. Purge the cache and retry:
pip cache purge pip install qiskit
6. Install with User Permissions
If you're getting permission errors (common on system-wide installs), install Qiskit to your user directory instead:
pip install qiskit --user
If None of These Work...
If you still see those red errors, share the full text of the error messages (especially the lines marked with *). That will help pinpoint exactly what's going wrong—whether it's a specific dependency failure, a system-specific issue, or something else.
内容的提问来源于stack exchange,提问作者Parth Jatakia

