CSDN - anaconda,conda,pip的关系
新浪博客 - Anaconda、Miniconda、Conda、pip的相互关系
使用上的理解:
pip -V / --version : 查看pip版本
pip list : 列出所有包
pip show package_name : 查找已安装包的信息
pip search package_name : 搜索 PyPI(Python Package Index) 的包
pip install package_name[==version] : 安装指定的包
pip / pip help / pip -h / pip --help :
Usage:
pip [options]
Commands:
install Install packages.
download Download packages.
uninstall Uninstall packages.
freeze Output installed packages in requirements format.
list List installed packages.
show Show information about installed packages.
check Verify installed packages have compatible dependencies.
config Manage local and global configuration.
search Search PyPI for packages.
wheel Build wheels from your requirements.
hash Compute hashes of package archives.
completion A helper command used for command completion.
help Show help for commands.
General Options:
-h, --help Show help.
--isolated Run pip in an isolated mode, ignoring environment variables and user configuration.
-v, --verbose Give more output. Option is additive, and can be used up to 3 times.
-V, --version Show version and exit.
-q, --quiet Give less output. Option is additive, and can be used up to 3 times (corresponding to WARNING, ERROR, and CRITICAL logging levels).
--log Path to a verbose appending log.
--proxy Specify a proxy in the form [user:passwd@]proxy.server:port.
--retries Maximum number of retries each connection should attempt (default 5 times).
--timeout Set the socket timeout (default 15 seconds).
--exists-action Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort).
--trusted-host Mark this host as trusted, even though it does not have valid or any HTTPS.
--cert Path to alternate CA bundle.
--client-cert Path to SSL client certificate, a single file containing the private key and the certificate in PEM format.
--cache-dir Store the cache data in .
--no-cache-dir Disable the cache.
--disable-pip-version-check Don't periodically check PyPI to determine whether a new version of pip is available for download. Implied with --no-index.
--no-color Suppress colored output
conda -V / --version : 查看conda版本
conda list : 列出所有包
conda list package_name : 查找已安装包的信息
conda search package_name : 搜索PyPI(Python Package Index)的包
conda install package_name[==version] : 安装指定的包
conda update package_name[==version] : 更新包
conda info -e / --envs || conda env list : 列出所有conda环境
conda create -n env_name package_name[=version] : 创建新环境
conda create -n env_name_new --clone env_name_old : 克隆环境
conda activate env_name : 使用此环境
conda deactivate : 退出此环境
conda remove -n env_name --all : 删除指定环境
conda clean -p : 删除没有用的包,这个命令会检查哪些包没有在包缓存中被硬依赖到其他地方,并删除它们
conda clean -t : tar打包,通过conda clean -t可以将conda保存下来的tar包
conda clean -y -all : 删除所有的安装包及cache
添加镜像:
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes
显示配置:
conda config --show
conda config --show-sources
移除镜像:
conda config --remove channels 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/'
conda / conda help / conda -h / conda --help :
usage: conda-script.py [-h] [-V] command ...
conda is a tool for managing and deploying applications, environments and packag
es.
Options:
positional arguments:
command
clean Remove unused packages and caches.
config Modify configuration values in .condarc. This is modeled after the git config command. Writes to the user .condarc file (C:\Users\Administrator\.condarc) by default.
create Create a new conda environment from a list of specified packages.
help Displays a list of available conda commands and their help strings.
info Display information about current conda install.
init Initialize conda for shell interaction. [Experimental]
install Installs a list of packages into a specified conda environment.
list List linked packages in a conda environment.
package Low-level conda package utility. (EXPERIMENTAL)
remove Remove a list of packages from a specified conda environment.
uninstall Alias for conda remove.
run Run an executable in a conda environment. [Experimental]
search Search for packages and display associated information. The input is a MatchSpec, a query language for conda packages. See examples below.
update Updates conda packages to the latest compatible version.
upgrade Alias for conda update.
optional arguments:
-h, --help Show this help message and exit.
-V, --version Show the conda version number and exit.
conda commands available from other packages:
build
convert
debug
develop
env
index
inspect
metapackage
render
server
skeleton
verify
conda info -h / --help :
usage: conda-script.py info [-h] [--json] [-v] [-q] [-a] [--base] [-e] [-s] [--unsafe-channels]
Display information about current conda install.
Options:
optional arguments:
-h, --help Show this help message and exit.
-a, --all Show all information.
--base Display base environment path.
-e, --envs List all known conda environments.
-s, --system List environment variables.
--unsafe-channels Display list of channels with tokens exposed.
Output, Prompt, and Flow Control Options:
--json Report all output as json. Suitable for using conda programmatically.
-v, --verbose Use once for info, twice for debug, three times for trace.
-q, --quiet Do not display progress bar.
conda create -h / --help :
usage: conda-script.py create [-h] [--clone ENV] [-n ENVIRONMENT | -p PATH]
[-c CHANNEL] [--use-local] [--override-channels]
[--strict-channel-priority]
[--no-channel-priority]
[--no-deps | --only-deps] [--no-pin] [--copy]
[--no-shortcuts] [-C] [-k] [--offline] [-d]
[--json] [-q] [-v] [-y] [--download-only]
[--show-channel-urls] [--file FILE]
[--no-default-packages]
[package_spec [package_spec ...]]
Create a new conda environment from a list of specified packages. To use the cre
ated environment, use 'source activate envname' look in that directory first. T
his command requires either the -n NAME or -p PREFIX option.
Options:
positional arguments:
package_spec Packages to install or update in the conda environment.
optional arguments:
-h, --help Show this help message and exit.
--clone ENV Path to (or name of) existing local environment.
--file FILE Read package versions from the given file. Repeated file specifications can be passed (e.g. --file=file1 --file=file2).
Target Environment Specification:
-n ENVIRONMENT, --name ENVIRONMENT Name of environment.
-p PATH, --prefix PATH Full path to environment location (i.e. prefix).
Channel Customization:
-c CHANNEL, --channel CHANNEL
Additional channel to search for packages. These are URLs searched in the order they are given (including
file:// for local directories). Then, the defaults or channels from .condarc are searched (unless
--override-channels is given). You can use 'defaults' to get the default packages for conda. You can also
use any name and the .condarc channel_alias value will be prepended. The default channel_alias is
http://conda.anaconda.org/.
--use-local Use locally built packages. Identical to '-c local'.
--override-channels Do not search default or .condarc channels. Requires
--channel.
Solver Mode Modifiers:
--strict-channel-priority
Packages in lower priority channels are not considered if a package with the same name appears in a higher priority channel.
--no-channel-priority
Package version takes precedence over channel priority. Overrides the value given by `conda config --show channel_priority`.
--no-deps Do not install, update, remove, or change dependencies. This WILL lead to broken environments and inconsistent behavior. Use at your own risk.
--only-deps Only install dependencies.
--no-pin Ignore pinned file.
--no-default-packages Ignore create_default_packages in the .condarc file.
Package Linking and Install-time Options:
--copy Install all packages using copies instead of hard- or soft-linking.
--no-shortcuts Don't install start menu shortcuts
Networking Options:
-C, --use-index-cache Use cache of channel index files, even if it has expired.
-k, --insecure Allow conda to perform "insecure" SSL connections and transfers. Equivalent to setting 'ssl_verify' to 'false'.
--offline Offline mode. Don't connect to the Internet.
Output, Prompt, and Flow Control Options:
-d, --dry-run Only display what would have been done.
--json Report all output as json. Suitable for using conda programmatically.
-q, --quiet Do not display progress bar.
-v, --verbose Can be used multiple times. Once for INFO, twice for DEBUG, three times for TRACE.
-y, --yes Do not ask for confirmation.
--download-only Solve an environment and ensure package caches are populated, but exit prior to unlinking and linking packages into the prefix.
--show-channel-urls Show channel urls. Overrides the value given by `conda config --show show_channel_urls`.
Examples:
conda create -n myenv sqlite