安装conda ,pyenv 创建python环境时 有时候需要 permission ,
但是默认是安装在用户系统环境下,sudo conda :command not found
method 1 : 授予 路径权限
sudo chown -R ubuntu /home/ubuntu/anaconda3
sudo chmod -R +x /home/ubuntu/anaconda3
/home/ubuntu/anaconda3 为 需要 权限 的 路径
method 2 添加到 sudo 路径中 使用 sudo command
To customize the default PATH variable for
sudo
session, open /etc/sudoers file with a text editor, and look for "secure_path". The value defined in "secure_path" will be used as the default PATH variable when you executesudo
commands.So add any necessary path (e.g., /usr/local/bin) to "secure_path", and it will be passed to
sudo
commands.Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
This change will be effective immediately.
-
sudo打开
sudo gedit /etc/sudoers
; gedit 是已经安装的文本编辑器 如果 是xubuntu 默认编辑器 mousepad :
sudo mousepad /etc/sudoers
找到 Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
添加 安装的 conda/bin 路径 ,注意
:
分隔保存 立即就能用 sudo conda 了
refer :