同步操作将从 PaddlePaddle/PaddleOCR 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
Windows and Mac users are recommended to use Anaconda to build a Python environment, and Linux users are recommended to use docker to build a Python environment.
Recommended working environment:
If you already have a Python environment installed, you can skip to PaddleOCR Quick Start.
Note: To use PaddlePaddle you need to install python environment first, here we choose python integrated environment Anaconda toolkit
Anaconda download.
Address: https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/?C=M&O=D
Most Win10 computers are 64-bit operating systems, choose x86_64 version; if the computer is a 32-bit operating system, choose x86.exe
After the download is complete, double-click the installer to enter the graphical interface
The default installation location is C drive, it is recommended to change the installation location to D drive.
Check Conda to add environment variables and ignore the warning that
Open Anaconda Prompt terminal: bottom left Windows Start Menu -> Anaconda3 -> Anaconda Prompt start console
Create a new Conda environment
# Enter the following command at the command line to create an environment named paddle_env
# Here to speed up the download, use the Tsinghua source
conda create --name paddle_env python=3.8 --channel https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ # This is a one line command
This command will create an executable environment named paddle_env with python version 3.8, which will take a while depending on the network status
The command line will then output a prompt, type y and enter to continue the installation
To activate the Conda environment you just created, enter the following command at the command line.
# Activate the paddle_env environment
conda activate paddle_env
# View the current location of python
where python
The above anaconda environment and python environment are installed
Note: To use PaddlePaddle you need to install the python environment first, here we choose the python integrated environment Anaconda toolkit
Anaconda download:.
Anaconda3-2021.05-MacOSX-x86_64.pkg
at the bottom to downloadAfter downloading, double click on the .pkg file to enter the graphical interface
It is recommended to install a code editor such as VSCode or PyCharm
Open the terminal
Add Conda to the environment variables
Environment variables are added so that the system can recognize the Conda command
Open ~/.bash_profile
in the terminal by typing the following command.
vim ~/.bash_profile
Add Conda as an environment variable in ~/.bash_profile
.
# Press i first to enter edit mode
# In the first line type.
export PATH="~/opt/anaconda3/bin:$PATH"
# If you customized the installation location during installation, change ~/opt/anaconda3/bin to the bin folder in the customized installation directory
# The modified ~/.bash_profile file should look like this (where xxx is the username)
export PATH="~/opt/anaconda3/bin:$PATH"
# >>> conda initialize >>>
# !!! Contents within this block are managed by 'conda init' !!!
__conda_setup="$('/Users/xxx/opt/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/Users/xxx/opt/anaconda3/etc/profile.d/conda.sh" ]; then
. "/Users/xxx/opt/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/Users/xxx/opt/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
esc
to exit edit mode, then type :wq!
and enter to save and exitVerify that the Conda command is recognized.
source ~/.bash_profile
in the terminal to update the environment variablesconda info --envs
in the terminal again, if it shows that there is a base environment, then Conda has been added to the environment variablesCreate a new Conda environment
# Enter the following command at the command line to create an environment called paddle_env
# Here to speed up the download, use Tsinghua source
conda create --name paddle_env python=3.8 --channel https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
This command will create an executable environment named paddle_env with python version 3.8, which will take a while depending on the network status
The command line will then output a prompt, type y and enter to continue the installation
To activate the Conda environment you just created, enter the following command at the command line.
# Activate the paddle_env environment
conda activate paddle_env
# View the current location of python
where python
The above anaconda environment and python environment are installed
Linux users can choose to run either Anaconda or Docker. If you are familiar with Docker and need to train the PaddleOCR model, it is recommended to use the Docker environment, where the development process of PaddleOCR is run. If you are not familiar with Docker, you can also use Anaconda to run the project.
Note: To use PaddlePaddle you need to install the python environment first, here we choose the python integrated environment Anaconda toolkit
Download Anaconda.
Select the appropriate version for your operating system
uname -m
in the terminal to check the command set used by your systemDownload method 1: Download locally, then transfer the installation package to the Linux server
Download method 2: Directly use Linux command line to download
# First install wget
sudo apt-get install wget # Ubuntu
sudo yum install wget # CentOS
# Then use wget to download from Tsinghua source
# If you want to download Anaconda3-2021.05-Linux-x86_64.sh, the download command is as follows
wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-2021.05-Linux-x86_64.sh
# If you want to download another version, you need to change the file name after the last 1 / to the version you want to download
To install Anaconda.
sh Anaconda3-2021.05-Linux-x86_64.sh
at the command line
Add conda to the environment variables
If you have already added conda to the environment variable path during the installation, you can skip this step
Open ~/.bashrc
in a terminal.
# Enter the following command in the terminal.
vim ~/.bashrc
Add conda as an environment variable in ~/.bashrc
.
# Press i first to enter edit mode # In the first line enter.
export PATH="~/anaconda3/bin:$PATH"
# If you customized the installation location during installation, change ~/anaconda3/bin to the bin folder in the customized installation directory
# The modified ~/.bash_profile file should look like this (where xxx is the username)
export PATH="~/opt/anaconda3/bin:$PATH"
# >>> conda initialize >>>
# !!! Contents within this block are managed by 'conda init' !!!
__conda_setup="$('/Users/xxx/opt/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/Users/xxx/opt/anaconda3/etc/profile.d/conda.sh" ]; then
. "/Users/xxx/opt/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/Users/xxx/opt/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
esc
to exit edit mode, then type :wq!
and enter to save and exitVerify that the Conda command is recognized.
source ~/.bash_profile
in the terminal to update the environment variablesconda info --envs
in the terminal again, if it shows that there is a base environment, then Conda has been added to the environment variablesCreate a new Conda environment
# Enter the following command at the command line to create an environment called paddle_env
# Here to speed up the download, use Tsinghua source
conda create --name paddle_env python=3.8 --channel https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
This command will create an executable environment named paddle_env with python version 3.8, which will take a while depending on the network status
The command line will then output a prompt, type y and enter to continue the installation
To activate the Conda environment you just created, enter the following command at the command line.
# Activate the paddle_env environment
conda activate paddle_env
The above anaconda environment and python environment are installed
The first time you use this docker image, it will be downloaded automatically. Please be patient.
# Switch to the working directory
cd /home/Projects
# You need to create a docker container for the first run, and do not need to run the current command when you run it again
# Create a docker container named ppocr and map the current directory to the /paddle directory of the container
# If using CPU, use docker instead of nvidia-docker to create docker
sudo docker run --name ppocr -v $PWD:/paddle --network=host -it registry.baidubce.com/paddlepaddle/paddle:2.1.3-gpu-cuda10.2-cudnn7 /bin/bash
# If using GPU, use nvidia-docker to create docker
# docker image registry.baidubce.com/paddlepaddle/paddle:2.1.3-gpu-cuda11.2-cudnn8 is recommended for CUDA11.2 + CUDNN8.
sudo nvidia-docker run --name ppocr -v $PWD:/paddle --shm-size=64G --network=host -it registry.baidubce.com/paddlepaddle/paddle:2.1.3-gpu-cuda10.2-cudnn7 /bin/bash
You can also visit DockerHub to get the image that fits your machine.
# ctrl+P+Q to exit docker, to re-enter docker using the following command:
sudo docker container exec -it ppocr /bin/bash
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。