【教程】禁止conda自动激活base环境
?Conda初始化
使用brew
安装完miniconda
后提示
==> Caveats
Please run the following to setup your shell:
conda init "$(basename "${SHELL}")"
conda init zsh
之后cat ~/.zshrc
可以看到conda initialize
追加内容
此时每次运行zsh
都会自动激活base环境
?禁止conda自动激活base环境
conda config --set auto_activate_base false
?查看当前conda设置
cat ~/.condarc
如果没有在init后对conda进行其他设置
默认情况下.condarc
不存在
?查阅其他conda设置选项
conda config --describe
输出如下:
? ~ conda config --describe
# ######################################################
# ## Channel Configuration ##
# ######################################################
# # channels (sequence: primitive)
# # aliases: channel
# # env var string delimiter: ','
# # The list of conda channels to include for relevant operations.
# #
# channels:
# - defaults
# # channel_alias (str)
# # The prepended url location to associate with channel names.
# #
# channel_alias: https://conda.anaconda.org
# # default_channels (sequence: primitive)
# # env var string delimiter: ','
# # The list of channel names and/or urls used for the 'defaults'
# # multichannel.
# #
# default_channels:
# - https://repo.anaconda.com/pkgs/main
# - https://repo.anaconda.com/pkgs/r
# # override_channels_enabled (bool)
# # Permit use of the --overide-channels command-line flag.
# #
# override_channels_enabled: true
# # whitelist_channels (sequence: primitive)
# # env var string delimiter: ','
# # The exclusive list of channels allowed to be used on the system. Use
# # of any other channels will result in an error. If conda-build channels
# # are to be allowed, along with the --use-local command line flag, be
# # sure to include the 'local' channel in the list. If the list is empty
# # or left undefined, no channel exclusions will be enforced.
# #
# whitelist_channels: []
# # custom_channels (map: primitive)
# # A map of key-value pairs where the key is a channel name and the value
# # is a channel location. Channels defined here override the default
# # 'channel_alias' value. The channel name (key) is not included in the
# # channel location (value). For example, to override the location of
# # the 'conda-forge' channel where the url to repodata is
# # https://anaconda-repo.dev/packages/conda-forge/linux-64/repodata.json,
# # add an entry 'conda-forge: https://anaconda-repo.dev/packages'.
# #
# custom_channels:
# pkgs/pro: https://repo.anaconda.com
# # custom_multichannels (map: sequence)
# # A multichannel is a metachannel composed of multiple channels. The two
# # reserved multichannels are 'defaults' and 'local'. The 'defaults'
# # multichannel is customized using the 'default_channels' parameter. The
# # 'local' multichannel is a list of file:// channel locations where
# # conda-build stashes successfully-built packages. Other multichannels
# # can be defined with custom_multichannels, where the key is the
# # multichannel name and the value is a list of channel names and/or
# # channel urls.
# #
# custom_multichannels: {}
# # migrated_channel_aliases (sequence: primitive)
# # env var string delimiter: ','
# # A list of previously-used channel_alias values. Useful when switching
# # between different Anaconda Repository instances.
# #
# migrated_channel_aliases: []
# # migrated_custom_channels (map: primitive)
# # A map of key-value pairs where the key is a channel name and the value
# # is the previous location of the channel.
# #
# migrated_custom_channels: {}
# # add_anaconda_token (bool)
# # aliases: add_binstar_token
# # In conjunction with the anaconda command-line client (installed with
# # `conda install anaconda-client`), and following logging into an
# # Anaconda Server API site using `anaconda login`, automatically apply a
# # matching private token to enable access to private packages and
# # channels.
# #
# add_anaconda_token: true
# # allow_non_channel_urls (bool)
# # Warn, but do not fail, when conda detects a channel url is not a valid
# # channel.
# #
# allow_non_channel_urls: false
# # restore_free_channel (bool)
# # " Add the "free" channel back into defaults, behind
# # "main" in priority. The "free" channel was removed
# # from the collection of default channels in conda 4.7.0.
# #
# restore_free_channel: false
# # repodata_fns (sequence: primitive)
# # env var string delimiter: ','
# # Specify filenames for repodata fetching. The default is
# # ('current_repodata.json', 'repodata.json'), which tries a subset of
# # the full index containing only the latest version for each package,
# # then falls back to repodata.json. You may want to specify something
# # else to use an alternate index that has been reduced somehow.
# #
# repodata_fns:
# - current_repodata.json
# - repodata.json
# # use_only_tar_bz2 (NoneType, bool)
# # A boolean indicating that only .tar.bz2 conda packages should be
# # downloaded. This is forced to True if conda-build is installed and
# # older than 3.18.3, because older versions of conda break when conda
# # feeds it the new file format.
# #
# use_only_tar_bz2:
# # repodata_threads (int)
# # Threads to use when downloading and reading repodata. When not set,
# # defaults to None, which uses the default ThreadPoolExecutor behavior.
# #
# repodata_threads: 0
# ######################################################
# ## Basic Conda Configuration ##
# ######################################################
# # envs_dirs (sequence: primitive)
# # aliases: envs_path
# # env var string delimiter: ':'
# # The list of directories to search for named environments. When
# # creating a new named environment, the environment will be placed in
# # the first writable location.
# #
# envs_dirs: []
# # pkgs_dirs (sequence: primitive)
# # env var string delimiter: ','
# # The list of directories where locally-available packages are linked
# # from at install time. Packages not locally available are downloaded
# # and extracted into the first writable directory.
# #
# pkgs_dirs: []
# # default_threads (int)
# # Threads to use by default for parallel operations. Default is None,
# # which allows operations to choose themselves. For more specific
# # control, see the other *_threads parameters: * repodata_threads -
# # for fetching/loading repodata * verify_threads - for verifying
# # package contents in transactions * execute_threads - for carrying
# # out the unlinking and linking steps
# #
# default_threads: 0
# ######################################################
# ## Network Configuration ##
# ######################################################
# # client_ssl_cert (NoneType, str)
# # aliases: client_cert
# # A path to a single file containing a private key and certificate (e.g.
# # .pem file). Alternately, use client_ssl_cert_key in conjuction with
# # client_ssl_cert for individual files.
# #
# client_ssl_cert:
# # client_ssl_cert_key (NoneType, str)
# # aliases: client_cert_key
# # Used in conjunction with client_ssl_cert for a matching key file.
# #
# client_ssl_cert_key:
# # local_repodata_ttl (bool, int)
# # For a value of False or 0, always fetch remote repodata (HTTP 304
# # responses respected). For a value of True or 1, respect the HTTP
# # Cache-Control max-age header. Any other positive integer values is the
# # number of seconds to locally cache repodata before checking the remote
# # server for an update.
# #
# local_repodata_ttl: 1
# # offline (bool)
# # Restrict conda to cached download content and file:// based urls.
# #
# offline: false
# # proxy_servers (map: primitive)
# # A mapping to enable proxy settings. Keys can be either (1) a
# # scheme://hostname form, which will match any request to the given
# # scheme and exact hostname, or (2) just a scheme, which will match
# # requests to that scheme. Values are are the actual proxy server, and
# # are of the form 'scheme://[user:password@]host[:port]'. The optional
# # 'user:password' inclusion enables HTTP Basic Auth with your proxy.
# #
# proxy_servers: {}
# # remote_connect_timeout_secs (float)
# # The number seconds conda will wait for your client to establish a
# # connection to a remote url resource.
# #
# remote_connect_timeout_secs: 9.15
# # remote_max_retries (int)
# # The maximum number of retries each HTTP connection should attempt.
# #
# remote_max_retries: 3
# # remote_backoff_factor (int)
# # The factor determines the time HTTP connection should wait for
# # attempt.
# #
# remote_backoff_factor: 1
# # remote_read_timeout_secs (float)
# # Once conda has connected to a remote resource and sent an HTTP
# # request, the read timeout is the number of seconds conda will wait for
# # the server to send a response.
# #
# remote_read_timeout_secs: 60.0
# # ssl_verify (bool, str)
# # aliases: verify_ssl
# # Conda verifies SSL certificates for HTTPS requests, just like a web
# # browser. By default, SSL verification is enabled, and conda operations
# # will fail if a required url's certificate cannot be verified. Setting
# # ssl_verify to False disables certification verification. The value for
# # ssl_verify can also be (1) a path to a CA bundle file, or (2) a path
# # to a directory containing certificates of trusted CA.
# #
# ssl_verify: true
# ######################################################
# ## Solver Configuration ##
# ######################################################
# # aggressive_update_packages (sequence: primitive)
# # env var string delimiter: ','
# # A list of packages that, if installed, are always updated to the
# # latest possible version.
# #
# aggressive_update_packages:
# - ca-certificates
# - certifi
# - openssl
# # auto_update_conda (bool)
# # aliases: self_update
# # Automatically update conda when a newer or higher priority version is
# # detected.
# #
# auto_update_conda: true
# # channel_priority (ChannelPriority)
# # Accepts values of 'strict', 'flexible', and 'disabled'. The default
# # value is 'flexible'. With strict channel priority, packages in lower
# # priority channels are not considered if a package with the same name
# # appears in a higher priority channel. With flexible channel priority,
# # the solver may reach into lower priority channels to fulfill
# # dependencies, rather than raising an unsatisfiable error. With channel
# # priority disabled, package version takes precedence, and the
# # configured priority of channels is used only to break ties. In
# # previous versions of conda, this parameter was configured as either
# # True or False. True is now an alias to 'flexible'.
# #
# channel_priority: flexible
# # create_default_packages (sequence: primitive)
# # env var string delimiter: ','
# # Packages that are by default added to a newly created environments.
# #
# create_default_packages: []
# # disallowed_packages (sequence: primitive)
# # aliases: disallow
# # env var string delimiter: '&'
# # Package specifications to disallow installing. The default is to allow
# # all packages.
# #
# disallowed_packages: []
# # force_reinstall (bool)
# # Ensure that any user-requested package for the current operation is
# # uninstalled and reinstalled, even if that package already exists in
# # the environment.
# #
# force_reinstall: false
# # pinned_packages (sequence: primitive)
# # env var string delimiter: '&'
# # A list of package specs to pin for every environment resolution. This
# # parameter is in BETA, and its behavior may change in a future release.
# #
# pinned_packages: []
# # pip_interop_enabled (bool)
# # Allow the conda solver to interact with non-conda-installed python
# # packages.
# #
# pip_interop_enabled: false
# # track_features (sequence: primitive)
# # env var string delimiter: ','
# # A list of features that are tracked by default. An entry here is
# # similar to adding an entry to the create_default_packages list.
# #
# track_features: []
# # experimental_solver (ExperimentalSolverChoice)
# # A string to choose between the different solver logics implemented in
# # conda. A solver logic takes care of turning your requested packages
# # into a list of specs to add and/or remove from a given environment,
# # based on their dependencies and specified constraints.
# #
# experimental_solver: classic
# ######################################################
# ## Package Linking and Install-time Configuration ##
# ######################################################
# # allow_softlinks (bool)
# # When allow_softlinks is True, conda uses hard-links when possible, and
# # soft-links (symlinks) when hard-links are not possible, such as when
# # installing on a different filesystem than the one that the package
# # cache is on. When allow_softlinks is False, conda still uses hard-
# # links when possible, but when it is not possible, conda copies files.
# # Individual packages can override this setting, specifying that certain
# # files should never be soft-linked (see the no_link option in the build
# # recipe documentation).
# #
# allow_softlinks: false
# # always_copy (bool)
# # aliases: copy
# # Register a preference that files be copied into a prefix during
# # install rather than hard-linked.
# #
# always_copy: false
# # always_softlink (bool)
# # aliases: softlink
# # Register a preference that files be soft-linked (symlinked) into a
# # prefix during install rather than hard-linked. The link source is the
# # 'pkgs_dir' package cache from where the package is being linked.
# # WARNING: Using this option can result in corruption of long-lived
# # conda environments. Package caches are *caches*, which means there is
# # some churn and invalidation. With this option, the contents of
# # environments can be switched out (or erased) via operations on other
# # environments.
# #
# always_softlink: false
# # path_conflict (PathConflict)
# # The method by which conda handle's conflicting/overlapping paths
# # during a create, install, or update operation. The value must be one
# # of 'clobber', 'warn', or 'prevent'. The '--clobber' command-line flag
# # or clobber configuration parameter overrides path_conflict set to
# # 'prevent'.
# #
# path_conflict: clobber
# # rollback_enabled (bool)
# # Should any error occur during an unlink/link transaction, revert any
# # disk mutations made to that point in the transaction.
# #
# rollback_enabled: true
# # safety_checks (SafetyChecks)
# # Enforce available safety guarantees during package installation. The
# # value must be one of 'enabled', 'warn', or 'disabled'.
# #
# safety_checks: warn
# # extra_safety_checks (bool)
# # Spend extra time validating package contents. Currently, runs sha256
# # verification on every file within each package during installation.
# #
# extra_safety_checks: false
# # signing_metadata_url_base (NoneType, str)
# # Base URL for obtaining trust metadata updates (i.e., the `*.root.json`
# # and `key_mgr.json` files) used to verify metadata and (eventually)
# # package signatures.
# #
# signing_metadata_url_base:
# # shortcuts (bool)
# # Allow packages to create OS-specific shortcuts (e.g. in the Windows
# # Start Menu) at install time.
# #
# shortcuts: true
# # non_admin_enabled (bool)
# # Allows completion of conda's create, install, update, and remove
# # operations, for non-privileged (non-root or non-administrator) users.
# #
# non_admin_enabled: true
# # separate_format_cache (bool)
# # Treat .tar.bz2 files as different from .conda packages when filenames
# # are otherwise similar. This defaults to False, so that your package
# # cache doesn't churn when rolling out the new package format. If you'd
# # rather not assume that a .tar.bz2 and .conda from the same place
# # represent the same content, set this to True.
# #
# separate_format_cache: false
# # verify_threads (int)
# # Threads to use when performing the transaction verification step.
# # When not set, defaults to 1.
# #
# verify_threads: 0
# # execute_threads (int)
# # Threads to use when performing the unlink/link transaction. When not
# # set, defaults to 1. This step is pretty strongly I/O limited, and you
# # may not see much benefit here.
# #
# execute_threads: 0
# ######################################################
# ## Conda-build Configuration ##
# ######################################################
# # bld_path (str)
# # The location where conda-build will put built packages. Same as
# # 'croot', but 'croot' takes precedence when both are defined. Also used
# # in construction of the 'local' multichannel.
# #
# bld_path: ''
# # croot (str)
# # The location where conda-build will put built packages. Same as
# # 'bld_path', but 'croot' takes precedence when both are defined. Also
# # used in construction of the 'local' multichannel.
# #
# croot: ''
# # anaconda_upload (NoneType, bool)
# # aliases: binstar_upload
# # Automatically upload packages built with conda build to anaconda.org.
# #
# anaconda_upload:
# # conda_build (map: primitive)
# # aliases: conda-build
# # General configuration parameters for conda-build.
# #
# conda_build: {}
# ######################################################
# ## Output, Prompt, and Flow Control Configuration ##
# ######################################################
# # always_yes (NoneType, bool)
# # aliases: yes
# # Automatically choose the 'yes' option whenever asked to proceed with a
# # conda operation, such as when running `conda install`.
# #
# always_yes:
# # auto_activate_base (bool)
# # Automatically activate the base environment during shell
# # initialization.
# #
# auto_activate_base: true
# # auto_stack (int)
# # Implicitly use --stack when using activate if current level of nesting
# # (as indicated by CONDA_SHLVL environment variable) is less than or
# # equal to specified value. 0 or false disables automatic stacking, 1 or
# # true enables it for one level.
# #
# auto_stack: 0
# # changeps1 (bool)
# # When using activate, change the command prompt ($PS1) to include the
# # activated environment.
# #
# changeps1: true
# # env_prompt (str)
# # Template for prompt modification based on the active environment.
# # Currently supported template variables are '{prefix}', '{name}', and
# # '{default_env}'. '{prefix}' is the absolute path to the active
# # environment. '{name}' is the basename of the active environment
# # prefix. '{default_env}' holds the value of '{name}' if the active
# # environment is a conda named environment ('-n' flag), or otherwise
# # holds the value of '{prefix}'. Templating uses python's str.format()
# # method.
# #
# env_prompt: '({default_env}) '
# # json (bool)
# # Ensure all output written to stdout is structured json.
# #
# json: false
# # notify_outdated_conda (bool)
# # Notify if a newer version of conda is detected during a create,
# # install, update, or remove operation.
# #
# notify_outdated_conda: true
# # quiet (bool)
# # Disable progress bar display and other output.
# #
# quiet: false
# # report_errors (NoneType, bool)
# # Opt in, or opt out, of automatic error reporting to core maintainers.
# # Error reports are anonymous, with only the error stack trace and
# # information given by `conda info` being sent.
# #
# report_errors:
# # show_channel_urls (NoneType, bool)
# # Show channel URLs when displaying what is going to be downloaded.
# #
# show_channel_urls:
# # verbosity (int)
# # aliases: verbose
# # Sets output log level. 0 is warn. 1 is info. 2 is debug. 3 is trace.
# #
# verbosity: 0
# # unsatisfiable_hints (bool)
# # A boolean to determine if conda should find conflicting packages in
# # the case of a failed install.
# #
# unsatisfiable_hints: true
# # unsatisfiable_hints_check_depth (int)
# # An integer that specifies how many levels deep to search for
# # unsatisfiable dependencies. If this number is 1 it will complete the
# # unsatisfiable hints fastest (but perhaps not the most complete). The
# # higher this number, the longer the generation of the unsat hint will
# # take. Defaults to 3.
# #
# unsatisfiable_hints_check_depth: 2
? ~
?参考及引用
https://stackoverflow.com/questions/54429210/how-do-i-prevent-conda-from-activating-the-base-environment-by-default
?转载请注明出处
本文作者:双份浓缩馥芮白
原文链接:
版权所有,如需转载请注明出处。