我正在尝试创建一个虚拟环境。我跟着Conda和Medium的步骤。
在我需要获取新环境之前,一切正常。
conda info -e
# conda environments:
#
base * /Users/fwrenn/anaconda3
test_env /Users/fwrenn/anaconda3/envs/test_env
source ~/anaconda3/bin/activate test_env
_CONDA_ROOT=/Users/fwrenn/anaconda3: Command not found.
Badly placed ()'s.
我无法弄清楚这个问题。在这里搜索有解决方案,说添加行bash_profile,但我不在bash中工作,只有csh。它看起来像是无法在activate
中构建目录路径。
我的资料:
OSX
python --version
Python 3.6.3 :: Anaconda custom (64-bit)
conda --version
conda 4.4.7
不确定是什么导致了你的问题,但下面的代码对我没有任何问题(OSX,与你的相同版本的conda)。
创造环境
conda create -n test_env python=3.6.3 anaconda
如果documentation的conda create
不明确的一些解释:
-n test_env
为test_env设置环境名称python=3.6.3 anaconda
说你想在3.6.3版本的环境python中使用(正是你拥有的那个,你可以根据需要使用不同的那个)并打包anaconda。你可以把你需要的所有东西放在那里,用空格隔开,例如sqlite matplotlib requests
并以与python相同的方式指定其版本。激活
conda activate test_env
停用
conda deactivate
摆脱它
conda remove -n test_env --all
我能够解决我的问题。执行source activate test_env
命令没有拿起我的.bash_profile
,我通常在tcsh
工作。只需在bash
中启动子流程就足以让activate
工作了。我猜我错误地认为activate
命令会在bash
中启动子进程并使用bash
环境变量。
> conda info -e
> # conda environments:
> #
> base * ~/anaconda3
> test_env ~/anaconda3/envs/test_env
> bash
~$ source ~/anaconda3/bin/activate test_env
(test_env) ~$
(test_env) ~$ conda info -e
# conda environments:
#
test_env * ~/anaconda3/envs/test_env
root ~/anaconda3