未验证 提交 127e9f4c 编写于 作者: Z zqw_1997 提交者: GitHub

Support python3.11 in Darwin (#54739)

* add Darwin py3.11

* fix syntax
上级 ad80fbfe
...@@ -126,6 +126,18 @@ function cmake_base() { ...@@ -126,6 +126,18 @@ function cmake_base() {
else else
exit 1 exit 1
fi fi
elif [ "$1" == "cp311-cp311" ]; then
if [ -d "/Library/Frameworks/Python.framework/Versions/3.11" ]; then
export LD_LIBRARY_PATH=/Library/Frameworks/Python.framework/Versions/3.11/lib/
export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:/Library/Frameworks/Python.framework/Versions/3.11/lib/
export PATH=/Library/Frameworks/Python.framework/Versions/3.11/bin/:${PATH}
PYTHON_FLAGS="-DPYTHON_EXECUTABLE:FILEPATH=/Library/Frameworks/Python.framework/Versions/3.11/bin/python3
-DPYTHON_INCLUDE_DIR:PATH=/Library/Frameworks/Python.framework/Versions/3.11/include/python3.11/
-DPYTHON_LIBRARY:FILEPATH=/Library/Frameworks/Python.framework/Versions/3.11/lib/libpython3.11.dylib"
pip3.11 install --user -r ${PADDLE_ROOT}/python/requirements.txt
else
exit 1
fi
fi fi
else else
if [ "$1" != "" ]; then if [ "$1" != "" ]; then
...@@ -639,6 +651,8 @@ EOF ...@@ -639,6 +651,8 @@ EOF
pip3.9 uninstall -y paddlepaddle pip3.9 uninstall -y paddlepaddle
elif [ "$1" == "cp310-cp310" ]; then elif [ "$1" == "cp310-cp310" ]; then
pip3.10 uninstall -y paddlepaddle pip3.10 uninstall -y paddlepaddle
elif [ "$1" == "cp311-cp311" ]; then
pip3.11 uninstall -y paddlepaddle
fi fi
set -ex set -ex
...@@ -654,6 +668,9 @@ EOF ...@@ -654,6 +668,9 @@ EOF
elif [ "$1" == "cp310-cp310" ]; then elif [ "$1" == "cp310-cp310" ]; then
pip3.10 install --user ${PADDLE_ROOT}/dist/*.whl pip3.10 install --user ${PADDLE_ROOT}/dist/*.whl
pip3.10 install --user hypothesis pip3.10 install --user hypothesis
elif [ "$1" == "cp311-cp311" ]; then
pip3.11 install --user ${PADDLE_ROOT}/dist/*.whl
pip3.11 install --user hypothesis
fi fi
tmpfile_rand=`date +%s%N` tmpfile_rand=`date +%s%N`
tmpfile=$tmp_dir/$tmpfile_rand tmpfile=$tmp_dir/$tmpfile_rand
...@@ -3376,6 +3393,19 @@ function run_setup(){ ...@@ -3376,6 +3393,19 @@ function run_setup(){
else else
exit 1 exit 1
fi fi
elif [ "$1" == "cp311-cp311" ]; then
if [ -d "/Library/Frameworks/Python.framework/Versions/3.11" ]; then
export LD_LIBRARY_PATH=/Library/Frameworks/Python.framework/Versions/3.11/lib/
export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:/Library/Frameworks/Python.framework/Versions/3.11/lib/
export PATH=/Library/Frameworks/Python.framework/Versions/3.11/bin/:${PATH}
#after changing "PYTHON_LIBRARY:FILEPATH" to "PYTHON_LIBRARY" ,we can use export
export PYTHON_EXECUTABLE=/Library/Frameworks/Python.framework/Versions/3.11/bin/python3
export PYTHON_INCLUDE_DIR=/Library/Frameworks/Python.framework/Versions/3.11/include/python3.11/
export PYTHON_LIBRARY=/Library/Frameworks/Python.framework/Versions/3.11/lib/libpython3.11.dylib
pip3.11 install --user -r ${PADDLE_ROOT}/python/requirements.txt
else
exit 1
fi
fi fi
else else
if [ "$1" != "" ]; then if [ "$1" != "" ]; then
...@@ -3631,6 +3661,20 @@ function run_setup_mac(){ ...@@ -3631,6 +3661,20 @@ function run_setup_mac(){
else else
exit 1 exit 1
fi fi
elif [ "$1" == "cp311-cp311" ]; then
if [ -d "/Library/Frameworks/Python.framework/Versions/3.11" ]; then
export LD_LIBRARY_PATH=/Library/Frameworks/Python.framework/Versions/3.11/lib/
export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:/Library/Frameworks/Python.framework/Versions/3.11/lib/
export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:${PADDLE_ROOT}/build/third_party/install/lapack/lib
export PATH=/Library/Frameworks/Python.framework/Versions/3.11/bin/:${PATH}
#after changing "PYTHON_LIBRARY:FILEPATH" to "PYTHON_LIBRARY" ,we can use export
export PYTHON_EXECUTABLE=/Library/Frameworks/Python.framework/Versions/3.11/bin/python3
export PYTHON_INCLUDE_DIR=/Library/Frameworks/Python.framework/Versions/3.11/include/python3.11/
export PYTHON_LIBRARY=/Library/Frameworks/Python.framework/Versions/3.11/lib/libpython3.11.dylib
pip3.11 install --user -r ${PADDLE_ROOT}/python/requirements.txt
else
exit 1
fi
fi fi
else else
if [ "$1" != "" ]; then if [ "$1" != "" ]; then
...@@ -3667,6 +3711,14 @@ function run_setup_mac(){ ...@@ -3667,6 +3711,14 @@ function run_setup_mac(){
export PYTHON_INCLUDE_DIR=/opt/_internal/cpython-3.10.0/include/python3.10 export PYTHON_INCLUDE_DIR=/opt/_internal/cpython-3.10.0/include/python3.10
export PYTHON_LIBRARIES=/opt/_internal/cpython-3.10.0/lib/libpython3.so export PYTHON_LIBRARIES=/opt/_internal/cpython-3.10.0/lib/libpython3.so
pip3.10 install -r ${PADDLE_ROOT}/python/requirements.txt pip3.10 install -r ${PADDLE_ROOT}/python/requirements.txt
elif [ "$1" == "cp311-cp311" ]; then
export LD_LIBRARY_PATH=/opt/_internal/cpython-3.11.0/lib/:${LD_LIBRARY_PATH}
export PATH=/opt/_internal/cpython-3.11.0/bin/:${PATH}
#after changing "PYTHON_LIBRARY:FILEPATH" to "PYTHON_LIBRARY" ,we can use export
export PYTHON_EXECUTABLE=/opt/_internal/cpython-3.11.0/bin/python3.11
export PYTHON_INCLUDE_DIR=/opt/_internal/cpython-3.11.0/include/python3.11
export PYTHON_LIBRARIES=/opt/_internal/cpython-3.11.0/lib/libpython3.so
pip3.11 install -r ${PADDLE_ROOT}/python/requirements.txt
elif [ "$1" == "conda-python3.7" ]; then elif [ "$1" == "conda-python3.7" ]; then
export LD_LIBRARY_PATH=/opt/conda/lib/:${LD_LIBRARY_PATH} export LD_LIBRARY_PATH=/opt/conda/lib/:${LD_LIBRARY_PATH}
export PATH=/opt/conda/bin/:${PATH} export PATH=/opt/conda/bin/:${PATH}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册