当前位置:   article > 正文

pip 与 conda 命令_usage: conda-script.py [-h] [-v] command ... conda

usage: conda-script.py [-h] [-v] command ... conda-script.py: error: unrecog

pip与conda

CSDN - anaconda,conda,pip的关系
新浪博客 - Anaconda、Miniconda、Conda、pip的相互关系

使用上的理解:

  1. conda 安装包的时候会将默认依赖的很多包一起安装,如果之前没有这些包就下载,有但版本不合适就更新,如果已安装的包不兼容会将这些包卸载。当安装前会提示是否确认,所以要仔细看下小心卸掉已有的包或者将已有的包降低版本。
    pip 安装的时候依赖项相对于 conda 来说要少很多,只会安装必需的包,可能因此会产生版本不兼容问题,但不会对原有环境做太多变更。
  2. pip 是 python 官方库,包含的 python 包的范围要比 conda 大。

pip : python installer for python

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 <command> [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>                Path to a verbose appending log.
  --proxy <proxy>             Specify a proxy in the form [user:passwd@]proxy.server:port.
  --retries <retries>         Maximum number of retries each connection should attempt (default 5 times).
  --timeout <sec>             Set the socket timeout (default 15 seconds).
  --exists-action <action>    Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort).
  --trusted-host <hostname>   Mark this host as trusted, even though it does not have valid or any HTTPS.
  --cert <path>               Path to alternate CA bundle.
  --client-cert <path>        Path to SSL client certificate, a single file containing the private key and the certificate in PEM format.
  --cache-dir <dir>           Store the cache data in <dir>.
  --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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36

conda

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
  • 1
  • 2

显示配置:

conda config --show
conda config --show-sources
  • 1
  • 2

移除镜像:

conda config --remove channels 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/' 
  • 1

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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42

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.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18

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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/从前慢现在也慢/article/detail/584584
推荐阅读
相关标签
  

闽ICP备14008679号