Change the default path and copy, delete, and create a Conda virtual environment when conda creates a virtual environment

insert image description here
The conda environment is installed in the user directory C:\Users\username.conda\envs by default. If you choose the default path, then create a virtual environment later and install it in the user directory. If you don’t want to take up space on the C drive, you can modify the conda virtual environment path.

insert image description here

Modify the default virtual environment path method

  1. First, find the .condarc file in the user directory (C:\Users\username).

  2. After opening the .condarc file, add or modify env_dirs in .condarc to set the environment path. The first path in order is used as the default storage path, and the search environment is searched in each directory in order. Add directly in .condarc:

envs_dirs:
  - D:\SoftD\08envs
pkgs_dirs:
  - D:\SoftD\08envs

insert image description here

Then, execute in Anaconda Prompt

conda info

You can see that the default environment path has been modified successfully

copy virtual environment

conda create -n new_env --clone old_env       #new_env表示新的虚拟环境的名字,old_env表示老虚拟环境的名字。

insert image description here
insert image description here

insert image description here

(The default is to generate a virtual environment in the specified path) (it is still quite large, so do not generate it on the c drive)
This pt17three virtual environment is generated to run the opencv project (to solve the version problem)

Lower the opencv-python version

The pt17three virtual environment is to run the opencv project.
The original version is:
insert image description here

insert image description here

Need to change to:
insert image description here

  1. Uninstall the current version of CV2
pip uninstall opencv-python
pip uninstall opencv-contrib-python

insert image description here

Install the specified version of CV3

pip install opencv-python==3.4.1.15 -i https://pypi.mirrors.ustc.edu.cn/simple
pip install opencv-contrib-python==3.4.1.15 -i https://pypi.mirrors.ustc.edu.cn/simple

insert image description here
This kind of yellow word is usually the problem of opening an agency. Before that, I was young and ignorant, so I did it for a long time. . .

insert image description here
Reason: Due to issues such as patents, opencv3.4.1.15 is the last version that can use sift and surf. This version supports up to python3.6 . If python3.7 or even 3.8 is installed, you can reinstall the 3.6 version of python.

Return python 3.7 version to python 3.6 version in Anaconda

conda install Python=3.6

insert image description here

This involves other version libraries, it may not work, you have to create a new python3.6 environment and install opencv3.4

Delete the virtual environment (pt17three environment):

conda remove -n pt17three --all

insert image description here
insert image description here

Create a virtual environment

insert image description here

conda create --name cv3 python=3.6

insert image description here
install opencv

pip install opencv-python==3.4.1.15 -i https://pypi.mirrors.ustc.edu.cn/simple
pip install opencv-contrib-python==3.4.1.15 -i https://pypi.mirrors.ustc.edu.cn/simple

insert image description here
insert image description here

Install torch17

Installing torch17
is now cuda11. . .
I installed 10.1 and need to upgrade. . .
insert image description here

Guess you like

Origin blog.csdn.net/qq_41701723/article/details/129171317