Colab installs miniconda and possible problems

1. Select the MiniConda version and download it

After confirming the python version, go to the official website to find the MiniConda version of the Linux system and x84_64 architecture
and download it, and add executable permissions to the downloaded file:

!wget -c https://repo.anaconda.com/miniconda/Miniconda3-py310_22.11.1-1-Linux-x86_64.sh
!ls
!chmod +x Miniconda3-py37_4.10.3-Linux-x86_64.sh

2. Install MiniConda

%env PYTHONPATH=
!bash ./Miniconda3-py310_22.11.1-1-Linux-x86_64.sh -b -f -p /usr/local

If the error message "CondaFileIOError: '/usr/local/pkgs/envs/ /env.txt'. [Errno 2] No such file or directory: '/usr/local/pkgs/envs/ /env.txt'"
is because without bash

3. View conda location and version

!which conda
!conda --version
!which python
!python -V

Fourth, add environment variables

Here you need to replace the python version with your own installed version

import sys
_ = (sys.path.append("/usr/local/lib/python3.10/site-packages"))

All packages installed with Conda will be installed in the directory /usr/local/lib/python3.10/site-packages, so we need to add this directory to sys.path so that these packages can be imported

Five, view the conda environment

!conda env list

if appear

base                     /usr/local

It shows that the dependent library can be installed normally using conda

Guess you like

Origin blog.csdn.net/weixin_50497501/article/details/130618116