2021-07-27 15:33:05 +08:00
# copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
2021-08-06 12:08:16 +08:00
import sys
2021-07-30 09:57:23 +08:00
import os
import subprocess
2021-08-06 12:08:16 +08:00
python_path = sys . executable
2021-10-25 11:09:00 +08:00
ori_path = os . getcwd ( )
2024-04-21 21:46:20 +08:00
os . chdir ( " ppocr/postprocess/pse_postprocess/pse " )
if (
subprocess . call ( " {} setup.py build_ext --inplace " . format ( python_path ) , shell = True )
!= 0
) :
2021-11-02 16:10:43 +08:00
raise RuntimeError (
2024-04-21 21:46:20 +08:00
" Cannot compile pse: {} , if your system is windows, you need to install all the default components of `desktop development using C++` in visual studio 2019+ " . format (
os . path . dirname ( os . path . realpath ( __file__ ) )
)
)
2021-10-25 11:09:00 +08:00
os . chdir ( ori_path )
2021-07-27 15:33:05 +08:00
2021-10-25 11:09:00 +08:00
from . pse import pse