diff --git a/python/paddle_serving_server/serve.py b/python/paddle_serving_server/serve.py index a8f1ad29151fd28050c0d15d92972c5e38908c4d..33c652c34b38e011661cba29782e196ac8da413f 100644 --- a/python/paddle_serving_server/serve.py +++ b/python/paddle_serving_server/serve.py @@ -23,9 +23,12 @@ import json import base64 import time from multiprocessing import Process -from web_service import WebService, port_is_available +from .web_service import WebService, port_is_available from flask import Flask, request -from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer +if sys.version_info.major == 2: + from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer +elif sys.version_info.major == 3: + from http.server import BaseHTTPRequestHandler, HTTPServer def parse_args(): # pylint: disable=doc-string-missing diff --git a/python/paddle_serving_server_gpu/serve.py b/python/paddle_serving_server_gpu/serve.py index 2bba8a451090f345b34a48ff58fda7d07b7794a7..739a74846a1a681e4f3d14894257bba8c1448ca9 100644 --- a/python/paddle_serving_server_gpu/serve.py +++ b/python/paddle_serving_server_gpu/serve.py @@ -25,7 +25,10 @@ import time from multiprocessing import Pool, Process from paddle_serving_server_gpu import serve_args from flask import Flask, request -from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer +if sys.version_info.major == 2: + from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer +elif sys.version_info.major == 3: + from http.server import BaseHTTPRequestHandler, HTTPServer def start_gpu_card_model(index, gpuid, port, args): # pylint: disable=doc-string-missing