gonzo ? ~/a/packages ? conda env list
# conda environments:
#
ppo_latest /nohome/jaan/abhishek/anaconda3/envs/ppo_latest
root * /nohome/jaan/abhishek/anaconda3
gonzo ? ~/a/packages ? conda activate ppo_latest
gonzo ? ~/a/packages ? which python (ppo_latest)
/nohome/jaan/abhishek/anaconda3/bin/python
gonzo ? ~/a/packages ? conda deactivate (ppo_latest)
gonzo ? ~/a/packages ? which python
/nohome/jaan/abhishek/anaconda3/bin/python
Run Code Online (Sandbox Code Playgroud)
环境被激活而没有错误.然后我们检查它指的是哪个python.它不会改变,为什么?
我正在尝试在 Google Colaboratory 上使用 conda 创建一个虚拟环境。但是,由于以下错误,我无法激活。
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run
$ conda init <SHELL_NAME>
Currently supported shells are:
- bash
- fish
- tcsh
- xonsh
- zsh
- powershell
See 'conda init --help' for more information and options.
IMPORTANT: You may need to close and restart your shell after running 'conda init
Run Code Online (Sandbox Code Playgroud)
我尝试了两个改进。我尝试了三个改进。一种是在~/.bashrc中加入如下代码。
# >>> conda init >>>
__conda_setup="$(CONDA_REPORT_ERRORS=false '$HOME/anaconda3/bin/conda' shell.bash hook 2> /dev/null)"
if [ …Run Code Online (Sandbox Code Playgroud) 这个问题可能与 2018 年提出的问题重复: conda environment in google colab [google-colaboratory]
但答案对我不起作用。
我注意到在 2020 年 1 月的另一个问题 Google Colab 中的 osmNX中也提到了它
并注意到数据科学堆栈上发布的相同问题 - 但答案对我也不起作用: https: //datascience.stackexchange.com/questions/75948/how-to-setup-and-run-conda-on-google-colab/75979 #75979
所以我认为问题仍然有效。
如何在Colab中激活conda环境?
找不到锻炼的方法。
重现步骤:
!wget https://repo.continuum.io/miniconda/Miniconda3-4.5.4-Linux-x86_64.sh
!bash Miniconda3-4.5.4-Linux-x86_64.sh -bfp /usr/local
Run Code Online (Sandbox Code Playgroud)
请注意警告:
...
installation finished.
WARNING:
You currently have a PYTHONPATH environment variable set. This may cause
unexpected behavior when running the Python interpreter in Miniconda3.
For best results, please verify that your PYTHONPATH only points to
directories of packages that are compatible with the …Run Code Online (Sandbox Code Playgroud) 我有一个environment.yml文件,我在本地系统上使用它,如下所示,
conda env create -f environment.yml
Run Code Online (Sandbox Code Playgroud)
但我现在已经转向 Google Colab 并使用此链接将 Conda 安装到其中。
现在,我如何像以前在本地系统上那样使用 .yml 文件在 Colab 内创建新的 conda 环境?
我有一个使用 Python 3.8.15 运行的 Conda 环境的 YML 文件 ( environment.yml)。我目前正在尝试根据以下答案将该文件加载到我的 Google Colab 中:
conda environment in google colab [google-colaboratory] 。
!wget -c https://repo.anaconda.com/archive/Anaconda3-2022.10-Windows-x86_64.exe
!chmod +x Anaconda3-2022.10-Windows-x86_64.exe
!bash ./Anaconda3-2022.10-Windows-x86_64.exe -b -f -p /usr/local
Run Code Online (Sandbox Code Playgroud)
虽然 Anaconda 的可执行文件安装在我的 Google Drive 文件夹中,但当我运行代码时,发现 Colab 无法执行该文件:
./Anaconda3-2022.10-Windows-x86_64.exe: ./Anaconda3-2022.10-Windows-x86_64.exe: cannot execute binary file
Run Code Online (Sandbox Code Playgroud)
我可以使用其他方法来安装 Anaconda 以便在 Google Colab 中使用它吗?此外,environment.yml让 Anaconda 在 Colab 中运行后,我应该如何加载我的文件?