1. 帮助信息
- 命令行下执行"conda -h"或“conda --help”可以获得帮助信息;
- 命令行下执行"conda <argument> -h"或“conda <argument> --help”可以获得具体参数的帮助信息;
conda --help usage: conda [-h] [-V] command ... conda is a tool for managing and deploying applications, environments and packages. Options: positional arguments: command info Display information about current conda install. help Displays a list of available conda commands and their help strings. list List linked packages in a conda environment. search Search for packages and display their information. The input is a Python regular expression. To perform a search with a search string that starts with a -, separate the search from the options with --, like 'conda search -- -h'. A * in the results means that package is installed in the current environment. A . means that package is not installed but is cached in the pkgs directory. create Create a new conda environment from a list of specified packages. install Installs a list of packages into a specified conda environment. update Updates conda packages to the latest compatible version. This command accepts a list of package names and updates them to the latest versions that are compatible with all other packages in the environment. Conda attempts to install the newest versions of the requested packages. To accomplish this, it may update some packages that are already installed, or install additional packages. To prevent existing packages from updating, use the --no-update-deps option. This may force conda to install older versions of the requested packages, and it does not prevent additional dependency packages from being installed. If you wish to skip dependency checking altogether, use the '--force' option. This may result in an environment with incompatible packages, so this option must be used with great caution. upgrade Alias for conda update. See conda update --help. remove Remove a list of packages from a specified conda environment. uninstall Alias for conda remove. See conda remove --help. config Modify configuration values in .condarc. This is modeled after the git config command. Writes to the user .condarc file (C:\Users\WQBin\.condarc) by default. clean Remove unused packages and caches. package Low-level conda package utility. (EXPERIMENTAL) optional arguments: -h, --help Show this help message and exit. -V, --version Show the conda version number and exit. other commands, such as "conda build", are available when additional conda packages (e.g. conda-build) are installed
2. 添加Conda代理和国内镜像
根据“conda -h”的提示信息,修改配置文件(如果没有,可以创建)
这里为“C:\Users\WQBin\.condarc”
它说这个命令和git的一样,我去。。。git我也不太熟
conda源操作的基本命令:
conda config --show 查看当前所有配置 conda config --show-sources 查看当前使用源 conda config --remove channels 删除指定源 conda config --add channels 加指定源
我已经添加了。正常来说用户只有default
1.设置代理
向文件C:\Users\WQBin\.condarc中添加如下:
proxy_servers: http: http://10.144.1.10:8080 https: http://10.144.1.10:8080
2.添加国内镜像源(国内清华大学镜像)
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/ conda config --set show_channel_urls yes
3.设置Conda环境和缓存的路径(一般不用设置)
默认情况下,Conda创建的新环境以及过往安装的模块缓存都存储在用户目录。
默认信息不会在Conda(user-specific)配置文件“$HOME/.condarc”中体现,但可通过"conda info"查看,包括默认环境路径、默认缓存路径、Conda源设置等。
添加或修改“$HOME/.condarc”中的“env_dirs”和“pkgs_dirs”配置项,可以设置conda环境和缓存(envs directories 和 package cache)的默认路径。
按顺序第一个路径作为默认存储路径,搜索环境和缓存时按先后顺序在各目录中查找。
例如:在“$HOME/.condarc”中添加如下路径
解释如下:
按顺序第一个路径作为默认存储路径,搜索环境和缓存时按先后顺序在各目录中查找
如果要改动有两种方法
方法一、在“$HOME/.condarc”中添加如下路径
envs_dirs: - D:\xxx\xxx\envs # 按顺序第一个路径作为默认存储路径,搜索环境和缓存时按先后顺序在各目录中查找 - C:\Users\xxx\AppData\Local\conda\conda\envs - C:\Users\xxx\.conda\envs pkgs_dirs: - D:\xxx\anaconda3\pkgs - C:\Users\xxx\AppData\Local\conda\conda\pkgs
方法二、
使用conda命令指定存放路径:
conda config --add envs_dirs <环境位置绝对路径> # 添加环境位置 conda config --add pkgs_dirs <包位置绝对路径> # 添加包位置
4 管理Python包
3.1 升级所有工具包
安装完成后,可以对所有工具包进行升级,在命令行执行“conda upgrade --all”,询问是否安装升级版本时,输入y。