欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

self service 脚本 安装 python 自己亲自做的 install_python_zhong 有大用 有大大用


#!/bin/bash
#
/bin/mkdir -p "${HOME}/Desktop/downloadfromjamf"
cd  "${HOME}/Desktop/downloadfromjamf"
/usr/bin/curl -o "./python-3.9.6-macosx10.9.pkg.zip"  http://jsfaq.luxshare-ict.com/util/software/python-3.9.6-macosx10.9.pkg.zip
unzip  -o  "./python-3.9.6-macosx10.9.pkg.zip"

sudo installer -pkg "./python-3.9.6-macosx10.9.pkg" -target /
# 下面两行的超级管理员下执行好像有问题,
#echo 'alias python=python3' >> "${HOME}/.bash_profile"  
#source "${HOME}/.bash_profile"
sudo echo 'alias python=python3' >> /etc/profile
source /etc/profile

py3_path=`which python3`
py_path=${py3_path%?}
sudo ln -s $py3_path $py_path  #这个如果是 /usr/bin/python3 ,,,因为SIP的启用,所有/usr/bin 可能写保护,所以无法创建快捷方式



#(/usr/bin/osascript -e "display dialog \"${HOME} \" buttons {\"OK\"}   default button \"OK\" "   )
#(/usr/bin/osascript -e "display dialog \"$py3_path \\n$py_path\" buttons {\"OK\"}   default button \"OK\" "   )
(/usr/bin/osascript -e  'display dialog "已安装python 3.9.6,在命令行输入 python ,若看到python 3.x.x的字样,说明安装成功!您可以删除桌面上的downloadfromjamf目录,如果打开python出现错误,请重启电脑!" buttons {"OK"}   default button "OK"')


#cd ../
#rm -Rf "${HOME}/Desktop/downloadfromjamf"
exit 0
普通分类: