Miniforge用户手册


1. Miniforge虚拟环境安装步骤

1.1. 下载安装器

下载路径:https://conda.loongnix.cn/miniforge/Miniforge-py38-Linux-loongarch64.sh
支持python版本:python3.8

1.2. 安装步骤

1.2.1.安装路径

按提示回车,默认安装路径为~/miniforge:

[loongson@localhost ~]$ bash Miniforge-py38-Linux-loongarch64.sh

Welcome to Miniforge py38

Miniforge will now be installed into this location:
/home/loongson/miniforge

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

[/home/loongson/miniforge] >>>
PREFIX=/home/loongson/miniforge
Unpacking payload ...

可在此处输入绝对路径自定义安装路径:

[/home/loongson/miniforge] >>>/home/loongson/test-env

1.2.2.初始化环境

在安装完软件包之后,需要初始化conda环境,直接按回车键或者输入yes:

installation finished.
Do you wish the installer to initialize Miniforge
by running conda init? [yes|no]
[no] >>> yes
modified      /home/loongson/miniforge/condabin/conda
modified      /home/loongson/miniforge/bin/conda
modified      /home/loongson/miniforge/bin/conda-env
no change     /home/loongson/miniforge/bin/activate
no change     /home/loongson/miniforge/bin/deactivate
no change     /home/loongson/miniforge/etc/profile.d/conda.sh
no change     /home/loongson/miniforge/etc/fish/conf.d/conda.fish
no change     /home/loongson/miniforge/shell/condabin/Conda.psm1
no change     /home/loongson/miniforge/shell/condabin/conda-hook.ps1
no change     /home/loongson/miniforge/lib/python3.8/site-packages/xontrib/conda.xsh
no change     /home/loongson/miniforge/etc/profile.d/conda.csh
no change     /home/loongson/.bashrc

1.2.3.进入虚拟环境

初始化完成后,需要重启或者刷新shell以进入环境,出现“base”(环境名称)字符时,代表成功进入conda环境:
方法1:

==> For changes to take effect, close and re-open your current shell. <==

If you'd prefer that conda's base environment not be activated on startup,
   set the auto_activate_base parameter to false:

conda config --set auto_activate_base false

Thank you for installing Miniforge!
[loongson@localhost ~]$ source ~/.bashrc
(base) [loongson@localhost ~]$

方法2:

[loongson@localhost ~]$ source /home/loongson/miniforge/bin/activate
(base) [loongson@localhost ~]$

2. conda常用命令

2.1. 查看当前虚拟环境信息

(base) [loongson@localhost ~]$ conda info
     active environment : base
    active env location : /home/loongson/miniforge
            shell level : 1
       user config file : /home/loongson/.condarc
 populated config files :
          conda version : 22.9.0
    conda-build version : not installed
         python version : 3.8.6.final.0
       virtual packages : __linux=4.19.190=0
                          __glibc=2.28=0
                          __unix=0=0
                          __archspec=1=loongarch64
       base environment : /home/loongson/miniforge  (writable)
      conda av data dir : /home/loongson/miniforge/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.loongnix.cn/LA-V1/linux-loongarch64
                          https://conda.loongnix.cn/LA-V1/noarch
          package cache : /home/loongson/miniforge/pkgs
                          /home/loongson/.conda/pkgs
       envs directories : /home/loongson/miniforge/envs
                          /home/loongson/.conda/envs
               platform : linux-loongarch64
             user-agent : conda/22.9.0 requests/2.26.0 CPython/3.8.6 Linux/4.19.190-6.2.4.lns8.loongarch64 loongnix-server/8.4.0 glibc/2.28
                UID:GID : 1000:1000
             netrc file : None
           offline mode : False

其中channel URLs为默认仓库地址

channel URLs : https://conda.loongnix.cn/LA-V1/linux-loongarch64
               https://conda.loongnix.cn/LA-V1/noarch

2.2. 新建虚拟环境

通过命令“conda create -n your_env_name python=x.x” 新建自定义名称的conda环境

(base) [loongson@localhost ~]$ conda create -n tmp python=3.8.6
Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: /home/loongson/miniforge/envs/tmp

  added / updated specs:
    - python=3.8.6

2.3. 激活环境

通过命令 “conda activate your_env_name” 激活新创建的环境

(base) [loongson@localhost ~]$ conda activate tmp
(tmp) [loongson@localhost ~]$

2.4. 退出环境

通过命令 “conda deactivate your_env_name” 退出当前环境

(tmp) [loongson@localhost ~]$ conda deactivate
[loongson@localhost ~]$

2.5. 删除环境

通过命令 “conda remove -n your_env_name --all” 删除这个新建的环境

(tmp) [loongson@localhost ~]$ conda deactivate
[loongson@localhost ~]$ conda remove -n tmp --all

Remove all packages in environment /home/loongson/miniforge/envs/tmp:

## Package Plan ##

  environment location: /home/loongson/miniforge/envs/tmp

The following packages will be REMOVED:

注意:必须先退出环境,才能删除环境

3. 修改默认仓库的方法

修改默认仓库的两种方式:一是通过命令行参数-c指定仓库;二是通过添加、修改配置文件指定仓库。

3.1. 命令行参数-c指定

命令:conda install -c channel-url package-name --override-channels

(base) [loongson@localhost ~]$ conda install -c file:///opt/tmp/tmp-repo1215 m4 --override-channels
Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: /home/loongson/miniforge

  added / updated specs:
    - m4

3.2. 修改配置文件

在家目录下创建、修改condarc文件:

(base) [loongson@localhost ~]$ touch ~/.condarc
(base) [loongson@localhost ~]$ vim  ~/.condarc  ##编辑
(base) [loongson@localhost ~]$ cat ~/.condarc
channels:
  - defaults
show_channel_urls: true
default_channels:
  - https://conda.loongnix.cn/LA-V1

4. 用户须知

目前conda仓库基于python 3.8版本实现,搭配龙芯python仓库使用,使用pip3.8安装wheel包。

(base) [loongson@localhost ~]$ cat /etc/pip.conf
[global]
timeout = 60
index-url = https://pypi.loongnix.cn/loongson/pypi
extra-index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host =
    pypi.loongnix.cn
    pypi.tuna.tsinghua.edu.cn

5. 反馈邮箱

如您在使用过程中遇到问题,或者有软件包需添加至仓库,请联系我们。 邮箱:service@loongnix.cn

©龙芯开源社区 all right reserved,powered by Gitbook文档更新时间: 2023-05-19 06:39:19

results matching ""

    No results matching ""

    results matching ""

      No results matching ""