如何在 Bash 中使用 Conda

How to use Conda in Bash

规格:

我已经安装了这两种类型:

me@PF2DCSXD:/home/me$ ls
Anaconda3   Miniconda3

然而,当我输入 conda:

me@PF2DCSXD:~$ conda
ERROR: The install method you used for conda--probably either `pip install conda`
or `easy_install conda`--is not compatible with using conda as an application.
If your intention is to install conda as a standalone application, currently
supported install methods include the Anaconda installer and the miniconda
installer.  You can download the miniconda installer from
https://conda.io/miniconda.html.

我使用输出 link ^.

安装了 Miniconda

我做错了什么? ;(


关注了所有这些 steps 但仍然一无所获

$ wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh
$ bash ~/miniconda.sh -b -p
$ rm ~/miniconda.sh
$ source $HOME/miniconda3/bin/activate
>> bash: /home/me/miniconda3/bin/activate: No such file or directory

您可能需要将 conda 添加到系统的变量路径中:

  1. 转到您的主目录:

    CD

  2. 打开.bashrc :

    纳米.bashrc

  3. 类型:

    导出 PATH="/PathOfYours/miniconda3/bin:$PATH"

  4. 保护 .bashrc 文件

  5. 现在在终端中重试:

    conda --version

现在应该可以解决问题了!

了解更多信息: https://developers.google.com/earth-engine/guides/python_install-conda#mac_3

我遵循了正确的步骤。

但是,我在该目录中有一个 MiniConda3 文件夹,是我手动下载的。

删除此文件夹时rm MiniConda3/ -r。 运行 这些相同的步骤随后奏效了。

me@PF2DCSXD:~$ rm Miniconda3/ -R
me@PF2DCSXD:~$ ls
'=0.0.7'   Anaconda3   miniconda.sh   nltk_data
me@PF2DCSXD:~$ wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh
--2022-02-14 14:11:03--  https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
Resolving repo.continuum.io (repo.continuum.io)... 104.18.201.79, 104.18.200.79, 2606:4700::6812:c84f, ...
Connecting to repo.continuum.io (repo.continuum.io)|104.18.201.79|:443... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh [following]
--2022-02-14 14:11:04--  https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
Resolving repo.anaconda.com (repo.anaconda.com)... 104.16.130.3, 104.16.131.3, 2606:4700::6810:8203, ...
Connecting to repo.anaconda.com (repo.anaconda.com)|104.16.130.3|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 66709754 (64M) [application/x-sh]
Saving to: ‘/home/me/miniconda.sh’

/home/me/miniconda.sh               100%[=================================================================================================>]  63.62M   945KB/s    in 55s     

2022-02-14 14:11:59 (1.16 MB/s) - ‘/home/me/miniconda.sh’ saved [66709754/66709754]

me@PF2DCSXD:~$ ls
'=0.0.7'   Anaconda3   miniconda.sh   nltk_data
me@PF2DCSXD:~$ ls -a
 .    .bash_history   .bashrc   .config            .gitconfig   .landscape   .motd_shown   .profile   .sudo_as_admin_successful   .vscode-server-server  '=0.0.7'     miniconda.sh
 ..   .bash_logout    .cache    .git-credentials   .keras       .local       .poetry       .ssh       .vscode-server              .wget-hsts              Anaconda3   nltk_data
me@PF2DCSXD:~$ bash ~/miniconda.sh -b -p
PREFIX=/home/me/miniconda3
Unpacking payload ...
Collecting package metadata (current_repodata.json): done                                                                                                                                                
Solving environment: done

## Package Plan ##

  environment location: /home/me/miniconda3

  added / updated specs:
    - _libgcc_mutex==0.1=main
    - _openmp_mutex==4.5=1_gnu
    - brotlipy==0.7.0=py39h27cfd23_1003
    - ca-certificates==2021.7.5=h06a4308_1
    - certifi==2021.5.30=py39h06a4308_0
    - cffi==1.14.6=py39h400218f_0
    - chardet==4.0.0=py39h06a4308_1003
    - conda-package-handling==1.7.3=py39h27cfd23_1
    - conda==4.10.3=py39h06a4308_0
    - cryptography==3.4.7=py39hd23ed53_0
    - idna==2.10=pyhd3eb1b0_0
    - ld_impl_linux-64==2.35.1=h7274673_9
    - libffi==3.3=he6710b0_2
    - libgcc-ng==9.3.0=h5101ec6_17
    - libgomp==9.3.0=h5101ec6_17
    - libstdcxx-ng==9.3.0=hd4cf53a_17
    - ncurses==6.2=he6710b0_1
    - openssl==1.1.1k=h27cfd23_0
    - pip==21.1.3=py39h06a4308_0
    - pycosat==0.6.3=py39h27cfd23_0
    - pycparser==2.20=py_2
    - pyopenssl==20.0.1=pyhd3eb1b0_1
    - pysocks==1.7.1=py39h06a4308_0
    - python==3.9.5=h12debd9_4
    - readline==8.1=h27cfd23_0
    - requests==2.25.1=pyhd3eb1b0_0
    - ruamel_yaml==0.15.100=py39h27cfd23_0
    - setuptools==52.0.0=py39h06a4308_0
    - six==1.16.0=pyhd3eb1b0_0
    - sqlite==3.36.0=hc218d9a_0
    - tk==8.6.10=hbc83047_0
    - tqdm==4.61.2=pyhd3eb1b0_1
    - tzdata==2021a=h52ac0ba_0
    - urllib3==1.26.6=pyhd3eb1b0_1
    - wheel==0.36.2=pyhd3eb1b0_0
    - xz==5.2.5=h7b6447c_0
    - yaml==0.2.5=h7b6447c_0
    - zlib==1.2.11=h7b6447c_3


The following NEW packages will be INSTALLED:

  _libgcc_mutex      pkgs/main/linux-64::_libgcc_mutex-0.1-main
  _openmp_mutex      pkgs/main/linux-64::_openmp_mutex-4.5-1_gnu
  brotlipy           pkgs/main/linux-64::brotlipy-0.7.0-py39h27cfd23_1003
  ca-certificates    pkgs/main/linux-64::ca-certificates-2021.7.5-h06a4308_1
  certifi            pkgs/main/linux-64::certifi-2021.5.30-py39h06a4308_0
  cffi               pkgs/main/linux-64::cffi-1.14.6-py39h400218f_0
  chardet            pkgs/main/linux-64::chardet-4.0.0-py39h06a4308_1003
  conda              pkgs/main/linux-64::conda-4.10.3-py39h06a4308_0
  conda-package-han~ pkgs/main/linux-64::conda-package-handling-1.7.3-py39h27cfd23_1
  cryptography       pkgs/main/linux-64::cryptography-3.4.7-py39hd23ed53_0
  idna               pkgs/main/noarch::idna-2.10-pyhd3eb1b0_0
  ld_impl_linux-64   pkgs/main/linux-64::ld_impl_linux-64-2.35.1-h7274673_9
  libffi             pkgs/main/linux-64::libffi-3.3-he6710b0_2
  libgcc-ng          pkgs/main/linux-64::libgcc-ng-9.3.0-h5101ec6_17
  libgomp            pkgs/main/linux-64::libgomp-9.3.0-h5101ec6_17
  libstdcxx-ng       pkgs/main/linux-64::libstdcxx-ng-9.3.0-hd4cf53a_17
  ncurses            pkgs/main/linux-64::ncurses-6.2-he6710b0_1
  openssl            pkgs/main/linux-64::openssl-1.1.1k-h27cfd23_0
  pip                pkgs/main/linux-64::pip-21.1.3-py39h06a4308_0
  pycosat            pkgs/main/linux-64::pycosat-0.6.3-py39h27cfd23_0
  pycparser          pkgs/main/noarch::pycparser-2.20-py_2
  pyopenssl          pkgs/main/noarch::pyopenssl-20.0.1-pyhd3eb1b0_1
  pysocks            pkgs/main/linux-64::pysocks-1.7.1-py39h06a4308_0
  python             pkgs/main/linux-64::python-3.9.5-h12debd9_4
  readline           pkgs/main/linux-64::readline-8.1-h27cfd23_0
  requests           pkgs/main/noarch::requests-2.25.1-pyhd3eb1b0_0
  ruamel_yaml        pkgs/main/linux-64::ruamel_yaml-0.15.100-py39h27cfd23_0
  setuptools         pkgs/main/linux-64::setuptools-52.0.0-py39h06a4308_0
  six                pkgs/main/noarch::six-1.16.0-pyhd3eb1b0_0
  sqlite             pkgs/main/linux-64::sqlite-3.36.0-hc218d9a_0
  tk                 pkgs/main/linux-64::tk-8.6.10-hbc83047_0
  tqdm               pkgs/main/noarch::tqdm-4.61.2-pyhd3eb1b0_1
  tzdata             pkgs/main/noarch::tzdata-2021a-h52ac0ba_0
  urllib3            pkgs/main/noarch::urllib3-1.26.6-pyhd3eb1b0_1
  wheel              pkgs/main/noarch::wheel-0.36.2-pyhd3eb1b0_0
  xz                 pkgs/main/linux-64::xz-5.2.5-h7b6447c_0
  yaml               pkgs/main/linux-64::yaml-0.2.5-h7b6447c_0
  zlib               pkgs/main/linux-64::zlib-1.2.11-h7b6447c_3


Preparing transaction: done
Executing transaction: done
installation finished.
me@PF2DCSXD:~$ source $HOME/miniconda3/bin/activate
(base) me@PF2DCSXD:~$