[解决方案]macbook下面root使用ln:无法创建符号链接"/usr/bin/python":权限不够,MAC /usr/bin/目录下 Operation not permitted的解决。
Mac系统 解决 python: No such file or directory
ln -s -f /usr/local/bin/python3.9 /usr/local/bin/python
python #无法解决
zsh: no such file or directory: /usr/local/Cellar/python@3.9/3.9.13_3/bin/python3.9 #在PATH里面有上面的软链接,但还是指向这个最新的py地址
/usr/local/bin/runlike #得把它加到环境变量中去没用,还是指向上面最新的。
which python
python: aliased to /usr/local/Cellar/python@3.9/3.9.13_3/bin/python3.9 #aliased指向了最新的
果然如此,vim ~/.zshrc:
alias python="/usr/local/Cellar/python@3.9/3.9.13_3/bin/python3.9"
alias pip="/usr/local/Cellar/python@3.9/3.9.13_3/bin/pip3.9"
alias pip3="/usr/local/Cellar/python@3.8/3.8.9/bin/pip3.8"
alias pip3.8="/usr/local/Cellar/python@3.8/3.8.9/bin/pip3.8"
alias pip3.9="/usr/local/Cellar/python@3.9/3.9.13_3/bin/pip3.9"
修改为就好了:
alias python="/usr/local/Cellar/python@3.9/3.9.14/bin/python3.9"
alias pip="/usr/local/Cellar/python@3.9/3.9.14/bin/pip3.9"
alias pip3="/usr/local/Cellar/python@3.9/3.9.14/bin/pip3.9"
alias pip3.8="/usr/local/Cellar/python@3.9/3.9.14/bin/pip3.9"
alias pip3.9="/usr/local/Cellar/python@3.9/3.9.14/bin/pip3.9"
ls /usr/local/Cellar/python@3.9/3.9.13_3/bin/python3.9
ls: /usr/local/Cellar/python@3.9/3.9.13_3/bin/python3.9: No such file or directory #因升级更新Mac新版本系统后没有了。
位置:/usr/bin sudo cp -rf python3 python
cp: python: Operation not permitted
ln -s /usr/bin/python3 /usr/bin/python
ln: /usr/bin/python: Operation not permitted
原因:系统保护机制
Disabling SIP
It's also possible to disable System Integrity Protection, but it's generally best to leave it on and do customization in more appropriate locations.
https://stackoverflow.com/questions/36730549/cannot-create-a-symlink-inside-of-usr-bin-even-as-sudo
Restart the system -> long press cmd + R. select a terminal from utilities menu type the following command csrutil disable close terminal and restart system.
来自:https://stackoverflow.com/questions/36730549/cannot-create-a-symlink-inside-of-usr-bin-even-as-sudo
MAC /usr/bin/目录下 Operation not permitted的解决
mac系统下的Rootless机制,让我们在root权限下也不能随心所欲的读写所有路径了,特殊情况下我们需要关闭Rootless时,可尝试如下操作:
1. 重启按住 Command+R,进入恢复模式,打开Terminal。
2. 键入命令 csrutil disable
3. reboot
Rootless机制是对抗恶意程序的最后防线,除非特殊需要时我们才将其关闭,否则保持开启状态
csrutil enable
原文链接:https://blog.csdn.net/king457757706/article/details/70671250
ln -s -f /usr/local/bin/python3.9 /usr/local/bin/python
python #无法解决
zsh: no such file or directory: /usr/local/Cellar/python@3.9/3.9.13_3/bin/python3.9 #在PATH里面有上面的软链接,但还是指向这个最新的py地址
/usr/local/bin/runlike #得把它加到环境变量中去没用,还是指向上面最新的。
which python
python: aliased to /usr/local/Cellar/python@3.9/3.9.13_3/bin/python3.9 #aliased指向了最新的
果然如此,vim ~/.zshrc:
alias python="/usr/local/Cellar/python@3.9/3.9.13_3/bin/python3.9"
alias pip="/usr/local/Cellar/python@3.9/3.9.13_3/bin/pip3.9"
alias pip3="/usr/local/Cellar/python@3.8/3.8.9/bin/pip3.8"
alias pip3.8="/usr/local/Cellar/python@3.8/3.8.9/bin/pip3.8"
alias pip3.9="/usr/local/Cellar/python@3.9/3.9.13_3/bin/pip3.9"
修改为就好了:
alias python="/usr/local/Cellar/python@3.9/3.9.14/bin/python3.9"
alias pip="/usr/local/Cellar/python@3.9/3.9.14/bin/pip3.9"
alias pip3="/usr/local/Cellar/python@3.9/3.9.14/bin/pip3.9"
alias pip3.8="/usr/local/Cellar/python@3.9/3.9.14/bin/pip3.9"
alias pip3.9="/usr/local/Cellar/python@3.9/3.9.14/bin/pip3.9"
ls /usr/local/Cellar/python@3.9/3.9.13_3/bin/python3.9
ls: /usr/local/Cellar/python@3.9/3.9.13_3/bin/python3.9: No such file or directory #因升级更新Mac新版本系统后没有了。
位置:/usr/bin sudo cp -rf python3 python
cp: python: Operation not permitted
ln -s /usr/bin/python3 /usr/bin/python
ln: /usr/bin/python: Operation not permitted
原因:系统保护机制
Disabling SIP
It's also possible to disable System Integrity Protection, but it's generally best to leave it on and do customization in more appropriate locations.
https://stackoverflow.com/questions/36730549/cannot-create-a-symlink-inside-of-usr-bin-even-as-sudo
Restart the system -> long press cmd + R. select a terminal from utilities menu type the following command csrutil disable close terminal and restart system.
来自:https://stackoverflow.com/questions/36730549/cannot-create-a-symlink-inside-of-usr-bin-even-as-sudo
MAC /usr/bin/目录下 Operation not permitted的解决
mac系统下的Rootless机制,让我们在root权限下也不能随心所欲的读写所有路径了,特殊情况下我们需要关闭Rootless时,可尝试如下操作:
1. 重启按住 Command+R,进入恢复模式,打开Terminal。
2. 键入命令 csrutil disable
3. reboot
Rootless机制是对抗恶意程序的最后防线,除非特殊需要时我们才将其关闭,否则保持开启状态
csrutil enable
原文链接:https://blog.csdn.net/king457757706/article/details/70671250
作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:https://jackxiang.com/post/11626/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!
最后编辑: jackxiang 编辑于2023-1-30 09:47
评论列表