- conda 第一次使用
conda activate base
命令时出现 CommandNotFoundError
codedancing@Ubuntu:/usr/local/anaconda3$ conda activate base
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate base'.
To initialize your shell, run
$ conda init <SHELL_NAME>
Currently supported shells are:
- bash
- fish
- tcsh
- xonsh
- zsh
- powershell
See 'conda init --help' for more information and options.
IMPORTANT: You may need to close and restart your shell after running 'conda init'.
解决:
需要输入 source activate
激活环境
- 使用
conda
创建python3.6新虚拟环境时遇到配置残留问题,打印信息:
(base) codedancing@Ubuntu:~$ conda create --name python3.6 python=3.6
Collecting package metadata (current_repodata.json): done
Solving environment: done
==> WARNING: A newer version of conda exists. <==
current version: 4.7.12
latest version: 4.8.1
Please update conda by running
$ conda update -n base -c defaults conda
## Package Plan ##
environment location: /usr/local/anaconda3/envs/python3.6
added / updated specs:
- python=3.6
The following packages will be downloaded:
package | build
---------------------------|-----------------
ca-certificates-2019.11.27 | 0 124 KB
certifi-2019.11.28 | py36_0 153 KB
ld_impl_linux-64-2.33.1 | h53a641e_7 568 KB
openssl-1.1.1d | h7b6447c_3 2.5 MB
pip-19.3.1 | py36_0 1.7 MB
python-3.6.10 | h0371630_0 29.7 MB
setuptools-44.0.0 | py36_0 510 KB
sqlite-3.30.1 | h7b6447c_0 1.1 MB
wheel-0.33.6 | py36_0 42 KB
------------------------------------------------------------
Total: 36.3 MB
The following NEW packages will be INSTALLED:
_libgcc_mutex pkgs/main/linux-64::_libgcc_mutex-0.1-main
ca-certificates pkgs/main/linux-64::ca-certificates-2019.11.27-0
certifi pkgs/main/linux-64::certifi-2019.11.28-py36_0
ld_impl_linux-64 pkgs/main/linux-64::ld_impl_linux-64-2.33.1-h53a641e_7
libedit pkgs/main/linux-64::libedit-3.1.20181209-hc058e9b_0
libffi pkgs/main/linux-64::libffi-3.2.1-hd88cf55_4
libgcc-ng pkgs/main/linux-64::libgcc-ng-9.1.0-hdf63c60_0
libstdcxx-ng pkgs/main/linux-64::libstdcxx-ng-9.1.0-hdf63c60_0
ncurses pkgs/main/linux-64::ncurses-6.1-he6710b0_1
openssl pkgs/main/linux-64::openssl-1.1.1d-h7b6447c_3
pip pkgs/main/linux-64::pip-19.3.1-py36_0
python pkgs/main/linux-64::python-3.6.10-h0371630_0
readline pkgs/main/linux-64::readline-7.0-h7b6447c_5
setuptools pkgs/main/linux-64::setuptools-44.0.0-py36_0
sqlite pkgs/main/linux-64::sqlite-3.30.1-h7b6447c_0
tk pkgs/main/linux-64::tk-8.6.8-hbc83047_0
wheel pkgs/main/linux-64::wheel-0.33.6-py36_0
xz pkgs/main/linux-64::xz-5.2.4-h14c3975_4
zlib pkgs/main/linux-64::zlib-1.2.11-h7b6447c_3
Proceed ([y]/n)? y
Downloading and Extracting Packages
certifi-2019.11.28 | 153 KB | ######################################################### | 100%
sqlite-3.30.1 | 1.1 MB | ######################################################### | 100%
setuptools-44.0.0 | 510 KB | ######################################################### | 100%
ld_impl_linux-64-2.3 | 568 KB | ######################################################### | 100%
pip-19.3.1 | 1.7 MB | ######################################################### | 100%
ca-certificates-2019 | 124 KB | ######################################################### | 100%
wheel-0.33.6 | 42 KB | ######################################################### | 100%
openssl-1.1.1d | 2.5 MB | ######################################################### | 100%
python-3.6.10 | 29.7 MB | ######################################################### | 100%
Preparing transaction: done
Verifying transaction: / WARNING conda.core.path_actions:verify(963): Unable to create environments file. Path not writable.
environment location: /home/codedancing/.conda/environments.txt
done
Executing transaction: \ WARNING conda.core.envs_manager:register_env(52): Unable to register environment. Path not writable or missing.
environment location: /usr/local/anaconda3/envs/python3.6
registry file: /home/codedancing/.conda/environments.txt
done
#
# To activate this environment, use
#
# $ conda activate python3.6
#
# To deactivate an active environment, use
#
# $ conda deactivate
(base) codedancing@Ubuntu:/usr/local/anaconda3$
问题:
Preparing transaction: done Verifying transaction: / WARNING conda.core.path_actions:verify(963): Unable to create environments file. Path not writable. environment location: /home/codedancing/.conda/environments.txt
Executing transaction: \ WARNING conda.core.envs_manager:register_env(52): Unable to register environment. Path not writable or missing. environment location: /usr/local/anaconda3/envs/python3.6 registry file: /home/codedancing/.conda/environments.txt
原因:
该系统用户之前以管理员身份安装过 conda 环境,需要删除用户家目录下的 ~/.conda
、 ~/.condarc
文件
使用 conda remove -n python3.6 --all
移除安装出现问题的虚拟环境,重新安装