Skip to content

Commit adae0a3

Browse files
authored
Merge pull request #13627 from velconia/mac_py3
Make Mac support Python3
2 parents 2c01c22 + 1512cf2 commit adae0a3

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

paddle/scripts/paddle_build.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ function cmake_gen() {
7070
PYTHON_FLAGS=""
7171
SYSTEM=`uname -s`
7272
if [ "$SYSTEM" == "Darwin" ]; then
73+
echo "Using python abi: $1"
7374
if [[ "$1" == "cp27-cp27m" ]] || [[ "$1" == "" ]]; then
74-
echo "using python abi: $1"
7575
if [ -d "/Library/Frameworks/Python.framework/Versions/2.7" ]; then
7676
export LD_LIBRARY_PATH=/Library/Frameworks/Python.framework/Versions/2.7
7777
export DYLD_LIBRARY_PATH=/Library/Frameworks/Python.framework/Versions/2.7
@@ -82,7 +82,18 @@ function cmake_gen() {
8282
else
8383
exit 1
8484
fi
85-
# TODO: qiyang add python3 part here
85+
elif [ "$1" == "cp35-cp35m" ]; then
86+
if [ -d "/Library/Frameworks/Python.framework/Versions/3.5" ]; then
87+
export LD_LIBRARY_PATH=/Library/Frameworks/Python.framework/Versions/3.5/lib/
88+
export DYLD_LIBRARY_PATH=/Library/Frameworks/Python.framework/Versions/3.5/lib/
89+
export PATH=/Library/Frameworks/Python.framework/Versions/3.5/bin/:${PATH}
90+
PYTHON_FLAGS="-DPYTHON_EXECUTABLE:FILEPATH=/Library/Frameworks/Python.framework/Versions/3.5/bin/python3
91+
-DPYTHON_INCLUDE_DIR:PATH=/Library/Frameworks/Python.framework/Versions/3.5/include/python3.5m/
92+
-DPYTHON_LIBRARY:FILEPATH=/Library/Frameworks/Python.framework/Versions/3.5/lib/libpython3.5m.dylib"
93+
WITH_FLUID_ONLY=${WITH_FLUID_ONLY:-ON}
94+
else
95+
exit 1
96+
fi
8697
fi
8798
else
8899
if [ "$1" != "" ]; then

0 commit comments

Comments
 (0)