INSTALL_FIX.md 2.8 KB

解决 numpy>=1.21.6 安装错误

问题描述

在安装 MinerU 项目依赖时遇到错误:

ERROR: Could not find a version that satisfies the requirement numpy>=1.21.6

解决方案

方案 1:使用 --user 选项安装(推荐)

由于 Windows 权限问题,推荐使用 --user 选项安装到用户目录:

python -m pip install --user --upgrade pip
python -m pip install --user numpy>=1.21.6

方案 2:使用国内镜像源(推荐中国用户)

如果网络较慢,可以使用国内镜像源加速安装:

临时使用镜像源:

# 使用清华大学镜像源
python -m pip install --user -i https://pypi.tuna.tsinghua.edu.cn/simple numpy>=1.21.6

# 或者使用阿里云镜像源
python -m pip install --user -i https://mirrors.aliyun.com/pypi/simple/ numpy>=1.21.6

# 或者使用中科大镜像源
python -m pip install --user -i https://pypi.mirrors.ustc.edu.cn/simple/ numpy>=1.21.6

永久配置镜像源:

创建或编辑 pip 配置文件:

  • Windows: %APPDATA%\pip\pip.ini
  • 或在用户目录下创建 pip.ini

添加以下内容:

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host = pypi.tuna.tsinghua.edu.cn

方案 3:安装完整项目依赖

如果需要安装整个 MinerU 项目,可以:

# 使用 --user 选项
python -m pip install --user -e .

# 或使用国内镜像源
python -m pip install --user -i https://pypi.tuna.tsinghua.edu.cn/simple -e .

方案 4:修复 pip 警告(可选)

如果看到如下警告:

WARNING: Ignoring invalid distribution ~ip (C:\Python312\Lib\site-packages)

可以尝试修复:

# 找到损坏的包目录(通常是 ~ip 或 ~ 开头)
# 然后手动删除它们,或运行:
python -m pip cache purge

方案 5:以管理员权限运行(如果上述方案都不行)

  1. 右键点击命令提示符或 PowerShell
  2. 选择"以管理员身份运行"
  3. 然后执行安装命令

验证安装

安装完成后,可以验证:

python -c "import numpy; print(numpy.__version__)"

应该输出类似:2.3.4 或更高版本

注意事项

  1. Python 版本要求:MinerU 要求 Python >=3.10,<3.14,当前版本 3.12.1 符合要求
  2. 权限问题:Windows 上安装全局包可能需要管理员权限,推荐使用 --user 选项
  3. 网络问题:如果下载速度慢,强烈建议使用国内镜像源
  4. PATH 配置:升级 pip 后,如果提示 PATH 问题,可以手动添加到环境变量,或使用 python -m pip 代替 pip

常用镜像源