ubuntu 24.04安装anaconda使所有用户能在上面安装独立环境

有一种奇妙的需求是,实验室某一台服务器需要装conda,既要保证其他用户能正常创建环境以及使用,又要让这些环境共有。

如果是这种情况,可以跟着本篇教程做。

如果仅为当前帐号安装的话,本教程兼容为当前帐号安装的情况。在sudo bash Anaconda3-2022.05-Linux-x86_64.sh部分都不用加sudo,然后配置完环境变量, init之后就可以使用了。

anaconda官网上下载anaconda安装包,国内可以在清华镜像上找到,但不知道镜像网站能维持多久,因为近期docker已经被关停了。

PS: 这里不建议下最新版的,因为可能存在不能创建低版本python环境的风险。这里我下载的是Anaconda3-2022.05-Linux-x86_64.sh

打开terminal,然后进入到对应目录:

sudo bash Anaconda3-2022.05-Linux-x86_64.sh

在页面输入enter,然后出现服务条款,按q,然后输入yes回车

In order to continue the installation process, please review the license
agreement.
Please, press ENTER to continue
>>>

==================================================

Copyright 2015-2022, Anaconda, Inc.

All rights reserved under the 3-clause BSD License:

This End User License Agreement (the "Agreement") is a legal agreement between y
ou and Anaconda, Inc. ("Anaconda") and governs your use of Anaconda Distribution
 (which was formerly known as Anaconda Individual Edition).

Subject to the terms of this Agreement, Anaconda hereby grants you a non-exclusi
ve, non-transferable license to:

  * Install and use the Anaconda Distribution (which was formerly known as Anaco
nda Individual Edition),
  * Modify and create derivative works of sample source code delivered in Anacon
da Distribution from Anaconda's repository, and;
  * Redistribute code files in source (if provided to you by Anaconda as source)
 and binary forms, with or without modification subject to the requirements set 
forth below, and;


Do you accept the license terms? [yes|no]
[no] >>> yes

然后放需要放的地方,默认是/root/anaconda3,这个位置不太好,因为其他用户没有权限访问,可以改成/opt/anaconda3之类的大家可以公共访问的

installation finished.
Do you wish the installer to initialize Anaconda3
by running conda init? [yes|no]
[no] >>> no

这里不初始化,然后用你的编辑器打开~/.bashrc,在最后一行加上

export PATH=/opt/anaconda3/bin:$PATH

然后开始写初始化代码,其他用户同样也需要这个步骤:

/opt/anaconda3/bin/conda shell.bash hook >> ~/.bashrc

导入环境变量以及初始化,最后在terminal键入

source ~/.bashrc

接着装环境和lib可能会挺慢的,只能借助国内镜像,在conda和pip上设置镜像源(此处省略步骤)

创建一个环境:

conda create -n py38 python=3.8

名为py38试试看

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
#     $ conda activate py38
#
# To deactivate an active environment, use
#
#     $ conda deactivate

OKOK,然后依照他的提示输入conda activate py38,即可

之后会讲解如何在环境上安装有GPU cuda的python库pytorch

  • 4
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Ubuntu 24.04是一款基于Linux的操作系统,下面是安装Ubuntu 24.04的步骤: 1. 下载Ubuntu 24.04的镜像文件:你可以从Ubuntu官方网站上下载最新的Ubuntu 24.04镜像文件。确保选择与你的计算机架构(32位或64位)相匹配的版本。 2. 制作启动盘:将下载的镜像文件写入USB闪存驱动器或者光盘。你可以使用一些工具如Rufus、Etcher等来制作启动盘。 3. 启动计算机:将制作好的启动盘插入计算机,并重启计算机。确保在计算机启动时选择从USB或光盘启动。 4. 选择安装方式:在启动时,你将看到一个安装界面。选择“Install Ubuntu”以开始安装过程。 5. 选择语言和键盘布局:在安装过程中,你需要选择你喜欢的语言和键盘布局。 6. 安装类型:在安装类型中,你可以选择“Erase disk and install Ubuntu”以清除整个硬盘并安装Ubuntu,或者选择“Something else”以手动分区。 7. 创建用户账户:在安装过程中,你需要设置一个用户名和密码,这将成为你登录Ubuntu时使用的账户。 8. 安装:完成上述步骤后,点击“Install”按钮开始安装Ubuntu 24.04安装过程可能需要一些时间,请耐心等待。 9. 完成安装安装完成后,你将看到一个提示窗口。点击“Restart Now”以重新启动计算机。 10. 登录Ubuntu:在计算机重新启动后,你将看到登录界面。输入之前设置的用户名和密码以登录Ubuntu。 希望以上步骤对你有所帮助!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值