【问题标题】:Anaconda3 installation procedure placed installation in unexpected directory and conda commands don't work under Ubuntu focal 20Anaconda3安装程序将安装放置在意外目录中,并且conda命令在Ubuntu焦点20下不起作用
【发布时间】:2020-10-07 18:55:34
【问题描述】:

我正在使用Ubuntu 20 focal,在Anaconda 安装过程和操作方面遇到问题。使用文件:Anaconda3-2020.07-Linux-x86_64.sh,并通过:sudo bash Anaconda3-2020.07-Linux-x86_64.sh 运行 我在欢迎信息后按ENTER,浏览所有协议消息并按我同意的yes,然后查看回复:

Please answer 'yes' or 'no':'
>>> yes

Anaconda3 will now be installed into this location:
/root/anaconda3

  - Press ENTER to confirm the location
  - Press CTRL-C to abort the installation
  - Or specify a different location below

[/root/anaconda3] >>> 

然后我按ENTER,开始安装,现在安装在

$ sudo ls /root/
anaconda3

但是,在此之后,预期的命令不起作用,例如;

$ conda list
conda: command not found

我无法使用 conda 卸载命令,我想知道安装过程应该如何进行。安装没有在~/中放置任何文件。

我也有一个Julia lang 安装,并且有一个来自 environment.txt 文件的引用;

$ ls ~/.conda/
environments.txt
usr3@usr3:~$ ls ~/.conda/environments.txt 
.conda/environments.txt
usr3@usr3:~$ head ~/.conda/environments.txt 
/home/usr3/.julia/conda/3
usr3@usr3:~$ ls /home/usr3/.julia/conda/
3/       deps.jl  
usr3@usr3:~$ ls /home/usr3/.julia/conda/3/
bin/                         installer.sh
compiler_compat/             lib/
condabin/                    LICENSE.txt
conda-meta/                  pkgs/
condarc-julia.yml            share/
envs/                        shell/
etc/                         ssl/
include/                     x86_64-conda_cos6-linux-gnu/

【问题讨论】:

  • 真的需要sudo 吗?这主要适用于管理多用户安装的系统管理员;典型安装从不需要提升权限。
  • @merv,我出于习惯使用了sudo。不假思索就来了。在尝试不使用 sudo 后,安装推荐了一个预期的目录 >>> yes Anaconda3 will now be installed into this location: /home/resort/anaconda3 - Press ENTER to confirm the location - Press CTRL-C to abort the installation - Or specify a different location below [/home/usr3/anaconda3] >>> ERROR: File or directory already exists: '/home/resort/anaconda3' If you want to update an existing installation, use the -u option. 虽然这似乎是一个进步,但这个新安装并没有参与 conda
  • 您是否运行了/home/resort/anaconda3/bin/conda init,然后重新启动了shell?
  • @merv,/home/resort/anaconda3/bin 没有conda-init 文件。它还有其他文件,例如conda-build
  • 应该只有conda; init 是一个参数。

标签: python linux ubuntu anaconda conda


【解决方案1】:

OP 中的意外安装位置可能是由于以提升的权限 (sudo bash ...) 运行安装程序所致。通常,只有系统管理员和其他管理多用户安装的人需要提升权限。默认安装不应使用sudo,而是会导致安装在用户家中的某个位置。

我已经有一段时间没有运行安装程序了,但我认为它现在包括自动运行 conda init 作为安装的一部分。如果没有,请咨询this answer,详细了解如何设置 Conda 的 shell 功能(例如,conda activate)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-20
    • 1970-01-01
    • 1970-01-01
    • 2019-04-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多