2017-03-02 69 views
0

我正在使用vagrant(MacOSX Sierra上的1.9.1)在VirtualBox上配置ubuntu/xenial64框来运行python应用程序。在配置时,我无法使用普通shell命令source激活conda环境。在我的bootstrap.sh中,我创建了一个新环境,然后切换到这个环境。在流浪外壳配置期间激活anaconda环境

#!/usr/bin/env bash 
set -e # Exit script immediately on first error. 
set -x # Print commands and their arguments as they are executed. 

/home/ubuntu/miniconda3/bin/conda create --name envmycondaenvironment python=3.5 # environment with python3.5 
source activate envgatherurls 

我收到以下来自流浪者的错误。

==> default: + source activate envmycondaenvironment 
==> default: /tmp/vagrant-shell: line 21: activate: No such file or directory 

为什么activate找不到shell脚本?我验证了/home/ubuntu/miniconda3/bin/,其中activate可被发现已添加到PATH中的.bashrc文件中。

回答

1

命令activateconda提供,并且不会自动添加到PATH环境变量中。请注意,bootstrap.sh脚本作为root而不是vagrant用户运行。因此,您需要确保用户/home/ubuntu/miniconda3/bin位于其路径中。如果我是你,我宁愿这样做:

#!/usr/bin/env bash 
set -e # Exit script immediately on first error. 
set -x # Print commands and their arguments as they are executed. 

export PATH=/home/ubuntu/miniconda3/bin:$PATH 
conda create --name envmycondaenvironment python=3.5 # environment with python3.5 
source activate envgatherurls 
+0

似乎已经做了伎俩。谢谢。 – hAcKnRoCk