Default paths and copies of virtual environments
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.
Modify the default virtual environment path method
-
First, find the .condarc file in the user directory (C:\Users\username).
-
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
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表示老虚拟环境的名字。
(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:
Need to change to:
- Uninstall the current version of CV2
pip uninstall opencv-python
pip uninstall opencv-contrib-python
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
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. . .
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
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
Create a virtual environment
conda create --name cv3 python=3.6
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
Install torch17
Installing torch17
is now cuda11. . .
I installed 10.1 and need to upgrade. . .