Win10-Python37-安装paddleocr及paddlepaddle

文章目录

      • 1. 安装Python37&pip版本升级
      • 2. 安装依赖文件
      • 3. lanms-neo==1.0.2可能会出现问题
      • 4.安装 paddleocr和paddlepaddle
      • 5. 测试是否安装成功

1. 安装Python37&pip版本升级

1.1 python 安装
	我安装使用的环境是Win10 + Python3.7.9,python版本可以到python官网进行下载
	安装。
1.2 pip 升级
	使用这个名称进行升级: python3.7 -m pip install --upgrade pip

2. 安装依赖文件

2.1 下载依赖文件:
	下载地址:https://github.com/PaddlePaddle/PaddleOCR
	进入 requirements.txt 文件所在目录。
	使用命令安装:pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
	我的requirements.txt 文件内容如下:大家可以参考安装
shapely
scikit-image
imgaug
pyclipper
lmdb
tqdm==4.64.1
numpy==1.19.3
visualdl
rapidfuzz
opencv-python==3.4.2.16
opencv-contrib-python==3.4.2.16
cython
lxml
premailer
openpyxl
attrdict
Polygon3
lanms-neo==1.0.2
PyMuPDF==1.19.0

3. lanms-neo==1.0.2可能会出现问题

问题:
 Building wheel for lanms-neo (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for lanms-neo (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [10 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-37
      creating build\lib.win-amd64-cpython-37\lanms
      copying lanms\__init__.py -> build\lib.win-amd64-cpython-37\lanms
      running build_ext
      building 'lanms._C' extension
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for lanms-neo
解决办法:
安装vs2022  可以选择社区版安装
安装地址:https://visualstudio.microsoft.com/zh-hans/vs/

Win10-Python37-安装paddleocr及paddlepaddle_第1张图片
Win10-Python37-安装paddleocr及paddlepaddle_第2张图片

安装完成后 新建一个项目,  然后执行 pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple

4.安装 paddleocr和paddlepaddle

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple paddleocr
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple paddlepaddle

5. 测试是否安装成功

运行以下代码 没有报错 则安装成功
from paddleocr import PaddleOCR, draw_ocr
ocr = PaddleOCR(use_angle_cls=True, lang="ch")

你可能感兴趣的:(python-ocr,paddlepaddle,python,人工智能)