Skip to content

Commit 3972dd8

Browse files
committed
test=develop, refine code
1 parent b17da93 commit 3972dd8

File tree

1 file changed

+126
-118
lines changed

1 file changed

+126
-118
lines changed

paddle/scripts/fast_install.sh

Lines changed: 126 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -566,138 +566,146 @@ gpu_list=("GeForce 410M"
566566
fi
567567
fi
568568
}
569-
570-
571-
function macos() {
572-
path='http://paddlepaddle.org/download?url='
573-
AVX=`sysctl -a | grep cpu | grep AVX1.0 | tail -1 | grep AVX`
574-
569+
function checkMacPaddleVersion(){
575570
while true
576-
do
577-
while true
578-
do
579-
read -p "请选择Paddle版本(默认是release):
580-
输入 1 来使用develop版本
581-
输入 2 来使用release ${release_version}
582-
请输入,或者按ctrl + c退出: " paddle_version
583-
if [ "$paddle_version" == "1" ]||[ "$paddle_version" == "2" ];then
584-
break
585-
else
586-
paddle_version="2"
587-
echo "将会下载release版本PaddlePaddle"
588-
break
589-
fi
590-
done
571+
do
572+
read -p "请选择Paddle版本(默认是release):
573+
输入 1 来使用develop版本
574+
输入 2 来使用release ${release_version}
575+
请输入,或者按ctrl + c退出: " paddle_version
576+
if [ "$paddle_version" == "1" ]||[ "$paddle_version" == "2" ];then
577+
break
578+
else
579+
paddle_version="2"
580+
echo "将会下载release版本PaddlePaddle"
581+
break
582+
fi
583+
done
584+
}
591585

592-
while true
593-
do
594-
read -p "请您选择希望使用的python版本
595-
输入 2 使用python2.x
596-
输入 3 使用python3.x
597-
请选择(默认为2),或者按ctrl + c退出:" python_V
598-
if [ "$python_V" == "" ];then
599-
python_V="2"
586+
function checkMacPythonVersion(){
587+
while true
588+
do
589+
read -p "请您选择希望使用的python版本
590+
输入 2 使用python2.x
591+
输入 3 使用python3.x
592+
请选择(默认为2),或者按ctrl + c退出:" python_V
593+
if [ "$python_V" == "" ];then
594+
python_V="2"
595+
fi
596+
if [ "$python_V" == "2" ];then
597+
python_root=`which python2.7`
598+
if [ "$python_root" == "" ];then
599+
python_root=`which python`
600600
fi
601-
if [ "$python_V" == "2" ];then
602-
python_root=`which python2.7`
603-
if [ "$python_root" == "" ];then
604-
python_root=`which python`
605-
fi
606-
python_version=`$python_root --version 2>&1 1>&1`
607-
if [ $? == "0" ];then
608-
:
601+
python_version=`$python_root --version 2>&1 1>&1`
602+
if [ $? == "0" ];then
603+
:
604+
else
605+
python_version=""
606+
fi
607+
if [ "$python_root" == "" ]||[ "$python_root" == "/usr/bin/python" -a "$python_version" == "Python 2.7.10" ]||[ "$python_root" == "/usr/bin/python2.7" -a "$python_version" == "Python 2.7.10" ];then
608+
check_python2
609+
fi
610+
while true
611+
do
612+
read -p "找到:$python_version, 是否使用:(y/n),输入n来输入自定义使用的python路径,或者按ctrl + c退出: " use_python
613+
use_python=`echo $use_python | tr 'A-Z' 'a-z'`
614+
if [ "$use_python" == "y" ]||[ "$use_python" == "" ];then
615+
break
616+
elif [ "$use_python" == "n" ];then
617+
python_root=""
618+
check_python2
619+
break
609620
else
610-
python_version=""
611-
fi
612-
if [ "$python_root" == "" ]||[ "$python_root" == "/usr/bin/python" -a "$python_version" == "Python 2.7.10" ]||[ "$python_root" == "/usr/bin/python2.7" -a "$python_version" == "Python 2.7.10" ];then
613-
check_python2
621+
echo "输入错误,请重新输入"
614622
fi
615-
while true
616-
do
617-
read -p "找到:$python_version, 是否使用:(y/n),输入n来输入自定义使用的python路径,或者按ctrl + c退出: " use_python
618-
use_python=`echo $use_python | tr 'A-Z' 'a-z'`
619-
if [ "$use_python" == "y" ]||[ "$use_python" == "" ];then
620-
break
621-
elif [ "$use_python" == "n" ];then
622-
python_root=""
623-
check_python2
624-
break
625-
else
626-
echo "输入错误,请重新输入"
627-
fi
628-
done
623+
done
629624

630-
elif [ "$python_V" == "3" ];then
631-
python_root=`which python3`
632-
python_version=`$python_root --version 2>&1 1>&1`
633-
if [ $? == "0" ];then
634-
:
635-
else
636-
python_version=""
637-
fi
638-
if [ "$python_root" == "" ]||[ "$python_root" == "/usr/bin/python" -a "$python_version" == "Python 2.7.10" ];then
639-
check_python3
640-
fi
641-
while true
642-
do
643-
read -p "找到:$python_version, 是否使用:(y/n), 输入n来输入自定义使用的python路径,或者按ctrl + c退出:" use_python
644-
use_python=`echo $use_python | tr 'A-Z' 'a-z'`
645-
if [ "$use_python" == "y" ]||[ "$use_python" == "" ];then
646-
break
647-
elif [ "$use_python" == "n" ];then
648-
check_python3
649-
break
650-
else
651-
echo "输入错误,请重新输入"
652-
fi
653-
done
654-
else
625+
elif [ "$python_V" == "3" ];then
626+
python_root=`which python3`
627+
python_version=`$python_root --version 2>&1 1>&1`
628+
if [ $? == "0" ];then
655629
:
630+
else
631+
python_version=""
656632
fi
657-
658-
659-
if [ "$python_V" == "2" ]||[ "$python_V" == "3" ];then
660-
python_brief_version=`$python_root -m pip -V |awk -F "[ |)]" '{print $6}'|sed 's#\.##g'`
661-
if [[ $python_brief_version == "27" ]];then
662-
uncode=`python -c "import pip._internal;print(pip._internal.pep425tags.get_supported())"|grep "cp27"`
663-
if [[ $uncode == "" ]];then
664-
uncode=mu
665-
else
666-
uncode=m
667-
fi
668-
fi
669-
if [[ "$python_brief_version" == "27" || "$python_brief_version" == "35" || "$python_brief_version" == "36" || "$python_brief_version" == "37" ]];then
633+
if [ "$python_root" == "" ]||[ "$python_root" == "/usr/bin/python" -a "$python_version" == "Python 2.7.10" ];then
634+
check_python3
635+
fi
636+
while true
637+
do
638+
read -p "找到:$python_version, 是否使用:(y/n), 输入n来输入自定义使用的python路径,或者按ctrl + c退出:" use_python
639+
use_python=`echo $use_python | tr 'A-Z' 'a-z'`
640+
if [ "$use_python" == "y" ]||[ "$use_python" == "" ];then
641+
break
642+
elif [ "$use_python" == "n" ];then
643+
check_python3
670644
break
671645
else
672-
echo "未发现可用的pip或pip3/pip3.x, 我们只支持Python2.7/3.5/3.6/3.7及其对应的pip, 请重新输入, 或使用ctrl + c退出"
646+
echo "输入错误,请重新输入"
673647
fi
674-
else
675-
echo "输入错误,请重新输入"
676-
fi
677-
done
648+
done
649+
else
650+
:
651+
fi
652+
678653

654+
if [ "$python_V" == "2" ]||[ "$python_V" == "3" ];then
655+
python_brief_version=`$python_root -m pip -V |awk -F "[ |)]" '{print $6}'|sed 's#\.##g'`
656+
if [[ $python_brief_version == "27" ]];then
657+
uncode=`python -c "import pip._internal;print(pip._internal.pep425tags.get_supported())"|grep "cp27"`
658+
if [[ $uncode == "" ]];then
659+
uncode=mu
660+
else
661+
uncode=m
662+
fi
663+
fi
664+
if [[ "$python_brief_version" == "27" || "$python_brief_version" == "35" || "$python_brief_version" == "36" || "$python_brief_version" == "37" ]];then
665+
break
666+
else
667+
echo "未发现可用的pip或pip3/pip3.x, 我们只支持Python2.7/3.5/3.6/3.7及其对应的pip, 请重新输入, 或使用ctrl + c退出"
668+
fi
669+
else
670+
echo "输入错误,请重新输入"
671+
fi
672+
done
673+
}
679674

680-
if [[ $AVX != "" ]];then
675+
function checkMacAVX(){
676+
if [[ $AVX != "" ]];then
681677
AVX=avx
682-
else
678+
else
683679
echo "您的Mac不支持AVX指令集,目前不能安装PaddlePaddle"
684-
fi
685-
680+
fi
681+
}
686682

687-
if [[ $GPU != "" ]];then
683+
function checkMacGPU(){
684+
if [[ $GPU != "" ]];then
688685
echo "MacOS上暂不支持GPU版本的PaddlePaddle, 将为您安装CPU版本的PaddlePaddle"
689-
else
686+
else
690687
echo "MacOS上暂不支持GPU版本的PaddlePaddle, 将为您安装CPU版本的PaddlePaddle"
691688
GPU=cpu
692-
fi
689+
fi
690+
}
693691

692+
function macos() {
693+
path='http://paddlepaddle.org/download?url='
694+
AVX=`sysctl -a | grep cpu | grep AVX1.0 | tail -1 | grep AVX`
695+
696+
while true
697+
do
698+
checkMacPaddleVersion
699+
checkMacPythonVersion
700+
checkMacAVX
701+
checkMacGPU
694702

695-
wheel_cpu_release="http://paddle-wheel.bj.bcebos.com/${release_version}-${GPU}-mac/paddlepaddle-1.2.0-cp${python_brief_version}-cp${python_brief_version}m-macosx_10_6_intel.whl"
696-
whl_cpu_release="paddlepaddle-1.2.0-cp${python_brief_version}-cp${python_brief_version}m-macosx_10_6_intel.whl"
697-
wheel_cpu_develop="http://paddle-wheel.bj.bcebos.com/latest-cpu-mac/paddlepaddle-latest-cp${python_brief_version}-cp${python_brief_version}m-macosx_10_6_intel.whl"
698-
whl_cpu_develop="paddlepaddle-latest-cp${python_brief_version}-cp${python_brief_version}m-macosx_10_6_intel.whl"
703+
wheel_cpu_release="http://paddle-wheel.bj.bcebos.com/${release_version}-${GPU}-mac/paddlepaddle-1.2.0-cp${python_brief_version}-cp${python_brief_version}m-macosx_10_6_intel.whl"
704+
whl_cpu_release="paddlepaddle-1.2.0-cp${python_brief_version}-cp${python_brief_version}m-macosx_10_6_intel.whl"
705+
wheel_cpu_develop="http://paddle-wheel.bj.bcebos.com/latest-cpu-mac/paddlepaddle-latest-cp${python_brief_version}-cp${python_brief_version}m-macosx_10_6_intel.whl"
706+
whl_cpu_develop="paddlepaddle-latest-cp${python_brief_version}-cp${python_brief_version}m-macosx_10_6_intel.whl"
699707

700-
if [[ $paddle_version == "2" ]];then
708+
if [[ $paddle_version == "2" ]];then
701709
if [ -f $whl_cpu_release ];then
702710
$python_root -m pip install $whl_cpu_release
703711
if [ $? == "0" ];then
@@ -715,25 +723,25 @@ function macos() {
715723
if [ $? == "0" ];then
716724
$python_root -m pip install $whl_cpu_release
717725
if [ $? == "0" ];then
718-
rm -rf $whl_cpu_release
726+
rm $whl_cpu_release
719727
echo "安装成功,可以使用: ${python_root} 来启动安装了PaddlePaddle的Python解释器"
720728
break
721729
else
722-
rm -rf $whl_cpu_release
730+
rm $whl_cpu_release
723731
echo "未能正常安装PaddlePaddle,请尝试更换您输入的python路径,或者ctrl + c退出后请检查您使用的python3对应的pip或pip源是否可用"
724732
echo""
725733
echo "=========================================================================================="
726734
echo""
727735
fi
728736
else
729-
rm -rf $whl_cpu_release
737+
rm $whl_cpu_release
730738
echo "未能正常安装PaddlePaddle,请检查您的网络,或者ctrl + c退出后反馈至https://github.com/PaddlePaddle/Paddle/issues"
731739
echo""
732740
echo "=========================================================================================="
733741
echo""
734742
fi
735743
fi
736-
else
744+
else
737745
if [ -f $whl_cpu_develop ];then
738746
$python_root -m pip install $whl_cpu_develop
739747
if [ $? == "0" ];then
@@ -751,25 +759,25 @@ function macos() {
751759
if [ $? == "0" ];then
752760
$python_root -m pip install $whl_cpu_develop
753761
if [ $? == "0" ];then
754-
rm -rf $wheel_cpu_develop
762+
rm $wheel_cpu_develop
755763
echo "安装成功,可以使用: ${python_root} 来启动安装了PaddlePaddle的Python解释器"
756764
break
757765
else
758-
rm -rf $whl_cpu_release
766+
rm $whl_cpu_release
759767
echo "未能正常安装PaddlePaddle,请尝试更换您输入的python路径,或者ctrl + c退出后请检查您使用的python3对应的pip或pip源是否可用"
760768
echo""
761769
echo "=========================================================================================="
762770
echo""
763771
fi
764772
else
765-
rm -rf $whl_cpu_develop
773+
rm $whl_cpu_develop
766774
echo "未能正常安装PaddlePaddle,请检查您的网络,或者ctrl + c退出后反馈至https://github.com/PaddlePaddle/Paddle/issues"
767775
echo""
768776
echo "=========================================================================================="
769777
echo""
770778
fi
771779
fi
772-
fi
780+
fi
773781
done
774782
}
775783

0 commit comments

Comments
 (0)