【发布时间】:2019-11-03 02:02:51
【问题描述】:
当我在 RHEL 上运行 python 时,我会自动使用 Anaconda3:
Python 3.7.3 (default, Mar 27 2019, 22:11:17)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
当我 sudo python 时,它默认为 python 2.7。
Python 2.7.5 (default, Sep 12 2018, 05:31:16)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
“which python” vs “sudo which python”给出:
/opt/anaconda3/bin/python
/bin/python
如何让 sudo 命令运行 Python 的 Anaconda 发行版。有没有改变这种情况的风险?
我可以永久进行更改,还是只使用完整的 Anaconda 路径从 sudo 运行 python?
【问题讨论】:
-
你试过
conda python吗? -
sudo 找不到 conda,不在其路径中
-
sudo /opt/anaconda3/bin/python 工作
-
这更多是一个问题,不同的 python 环境默认在 root sudo 访问下,而不是通过普通帐户