Create a new conda environment from a list of specified packages. To use the created environment, use 'conda activate envname' look in that directory first. This 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). --dev Use `sys.executable -m conda` in wrapper scripts instead of CONDA_EXE. This is mainly for use during tests where we test new conda source against old Python versions.
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 local directories using the 'file://' syntax or simply a path like '/home/conda/mychan' or '../mychan'). 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. --repodata-fn REPODATA_FNS Specify name of repodata on remote server. Conda will try whatever you specify, but will ultimately fall back to repodata.json if your specs are not satisfiable with what you specify here. This is used to employ repodata that is reduced in time scope. You may pass this flag more than once. Leftmost entries are tried first, and the fallback to repodata.json is added for you automatically.
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.
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`.
optional arguments: -h, --help Show this help message and exit. -f FILE, --file FILE environment definition file (default: environment.yml) -n ENVIRONMENT, --name ENVIRONMENT Name of environment. -p PATH, --prefix PATH Full path to environment prefix. -q, --quiet --force force creation of environment (removing a previously existing environment of the same name). --json Report all output as json. Suitable for using conda programmatically. --debug Show debug output. --verbose, -v Use once for info, twice for debug, three times for trace.
optional arguments: -h, --help Show this help message and exit. -n ENVIRONMENT, --name ENVIRONMENT Name of environment. -p PATH, --prefix PATH Full path to environment prefix. -f FILE, --file FILE environment definition (default: environment.yml) --prune remove installed packages not defined in environment.yml -q, --quiet --json Report all output as json. Suitable for using conda programmatically. --debug Show debug output. --verbose, -v Use once for info, twice for debug, three times for trace.
positional arguments: executable_call Executable name, with additional arguments to be passed to the executable on invocation.
optional arguments: -h, --help Show this help message and exit. -v, --verbose Use once for info, twice for debug, three times for trace. --dev Sets `CONDA_EXE` to `python -m conda`, assuming the CWD contains the root of conda development sources. This is mainly for use during tests where we test new conda source against old Python versions. --debug-wrapper-scripts When this is set, where implemented, the shell wrapper scriptswill echo to stderr a lot of debugging information. --cwd CWD Current working directory for command to run in. Defaults to cwd --no-capture-output Don't capture stdout/stderr --live-stream Display the output for the subprocess stdout and stderr on real time.
Target Environment Specification: -n ENVIRONMENT, --name ENVIRONMENT Name of environment. -p PATH, --prefix PATH Full path to environment location (i.e. prefix).
$ bin/conda run -n aais-2.7 python --version Python 2.7.16 :: Anaconda, Inc.
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
$ bin/conda run -n aais-2.7 which python # 显示aais-2.7 环境下面的python路径 /home/conda/envs/aais-2.7/bin/python
$ bin/conda run -n ota python --version # 显示ota环境下面 python 版本号 Python 2.7.18 :: Anaconda, Inc.
/* * Placeholder for custom user CSS mainly to be overridden * in profile/static/custom/custom.css * This will always be an empty file in IPython */ .CodeMirror pre { font-family: Consolas; font-size: 10pt; }
* { font-family: Consolas; }
div.output_area pre { font-family: Consolas; font-size: 10pt; }
Magics Jupyter Notebook中的魔术命令 You probably know that you can start notebooks with different kernels (e.g., R, Julia) — not just Python. What you might not know is that even within a notebook, you can run different types of code in different cells. With “magics”, it is possible to use different languages. The magics that are available vary per notebook kernel, however.
By running % lsmagic in a cell you get a list of all the available magics. You can use % to start a single-line expression to run with the magics command. Or you can use a double %% to run a multi-line expression.
Some of my favorites are:
% env to list your environment variables.
!: to run a shell command. E.g., ! pip freeze | grep pandas to see what version of pandas is installed.
% matplotlib inline to show matplotlib plots inline the notebook.
% pastebin 'file.py' to upload code to pastebin and get the url returned.
% bash to run cell with bash in a subprocess.
% time will time whatever you evaluate
% latex to render cell contents as LaTeX
%timeit will time whatever you evaluate multiple times and give you the best, and the average times
%prun, %lprun, %mprun can give you line-by-line breakdown of time and memory usage in a function or script. See a good tutorial here.
%% HTML: to render the cell as HTML. So you can even embed an image or other media in your notebook: