From d77bc12e11fc2311fd97a3058d27b48a8a5b8ce5 Mon Sep 17 00:00:00 2001 From: zhongpu <2013000149@qq.com> Date: Sun, 12 Apr 2020 22:47:55 +0800 Subject: [PATCH] fix install error in py36, test=develop (#23676) --- python/setup.py.in | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/python/setup.py.in b/python/setup.py.in index 24ca37a8daa..e5acc278e17 100644 --- a/python/setup.py.in +++ b/python/setup.py.in @@ -152,6 +152,30 @@ packages=['paddle', with open('@PADDLE_SOURCE_DIR@/python/requirements.txt') as f: setup_requires = f.read().splitlines() +# Note(wangzhongpu): +# When compiling paddle under python36, the dependencies belonging to python2.7 will be imported, resulting in errors when installing paddle +if sys.version_info >= (3,6) and sys.version_info < (3,7): + setup_requires_tmp = [] + for setup_requires_i in setup_requires: + if "<\"3.6\"" in setup_requires_i or "<\"3.5\"" in setup_requires_i or "<=\"3.5\"" in setup_requires_i: + continue + setup_requires_tmp+=[setup_requires_i] + setup_requires = setup_requires_tmp +if sys.version_info >= (3,5) and sys.version_info < (3,6): + setup_requires_tmp = [] + for setup_requires_i in setup_requires: + if "<\"3.5\"" in setup_requires_i: + continue + setup_requires_tmp+=[setup_requires_i] + setup_requires = setup_requires_tmp +if sys.version_info >= (3,7): + setup_requires_tmp = [] + for setup_requires_i in setup_requires: + if "<\"3.6\"" in setup_requires_i or "<=\"3.6\"" in setup_requires_i or "<\"3.5\"" in setup_requires_i or "<=\"3.5\"" in setup_requires_i or "<\"3.7\"" in setup_requires_i: + continue + setup_requires_tmp+=[setup_requires_i] + setup_requires = setup_requires_tmp + if '${CMAKE_SYSTEM_PROCESSOR}' not in ['arm', 'armv7-a', 'aarch64']: setup_requires+=['opencv-python'] -- GitLab