如何在conda中沉默或压制gfortran(或clang?)后端?

O.r*_*rka 10 fortran r clang anaconda conda

我一直在努力构建设计一个非常特别的畅达环境pythonR使用串扰rpy2.我想出的用于安装正确R软件包的方法如下:

# install_main_environment.sh
now=$(date +"%T")
echo "Start Time: $now"

## Create Main Environment (OSX-64)
conda create -n python3 python=3 --yes
source activate python3

## Jupyter
conda install jupyterlab --yes

## R
conda install -c r r --yes
conda install -c r r-essentials --yes
conda install -c r rstudio --yes
conda install gfortran_osx-64 --yes
conda install -c anaconda clangxx_osx-64 --yes
conda install rpy2 --yes

## Install Python Packages
source ./install_python_packages.sh

## Install R Packages
RScript ./install_r_packages.r

# End
now=$(date +"%T")
echo "End Time: $now"
Run Code Online (Sandbox Code Playgroud)

但是,其中一条线使得后端非常冗长,所以每当我获取/停用环境或安装包时,我都会得到一个非常详细的后端.

我怎样才能永久压制这个或者沉默额外的文字?在我的bash配置文件中,当我激活我的环境时,我将stderr&stdout指向/ dev/null,source activate python3 > /dev/null 2>&1但这只是一个非通用的补丁.

我的工作计算机OSX 10.11.6 (El Capitan)和我的个人计算机都存在这种情况 OSX Sierra.

以下是我在下面提到的输出示例:

jespinozlt-osx:~ jespinoz$ source activate python3

INFO: activate-gfortran_osx-64.sh made the following environmental changes:
+DEBUG_FFLAGS=-march=nocona -mtune=core2 -ftree-vectorize -fPIC -fstack-protector -O2 -pipe -march=nocona -mtune=core2 -ftree-vectorize -fPIC -fstack-protector -O2 -pipe -Og -g -Wall -Wextra -fcheck=all -fbacktrace -fimplicit-none -fvar-tracking-assignments
+F95=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-gfortran
+FC=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-gfortran
+FFLAGS=-march=nocona -mtune=core2 -ftree-vectorize -fPIC -fstack-protector -O2 -pipe
+FORTRANFLAGS=-march=nocona -mtune=core2 -ftree-vectorize -fPIC -fstack-protector -O2 -pipe
+GFORTRAN=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-gfortran
INFO: activate_clang_osx-64.sh made the following environmental changes:
+AR=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-ar
+AS=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-as
+CC=x86_64-apple-darwin13.4.0-clang
+CFLAGS=-march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe
+CHECKSYMS=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-checksyms
+CLANG=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-clang
+CODESIGN_ALLOCATE=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-codesign_allocate
+CONDA_BUILD_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk
+CPPFLAGS=-D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9
+DEBUG_CFLAGS=-march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -Og -g -Wall -Wextra
+INDR=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-indr
+INSTALL_NAME_TOOL=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-install_name_tool
+LD=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-ld
+LDFLAGS=-Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs
+LDFLAGS_LD=-pie -headerpad_max_install_names -dead_strip_dylibs
+LIBTOOL=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-libtool
+LIPO=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-lipo
+NM=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-nm
+NMEDIT=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-nmedit
+OTOOL=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-otool
+PAGESTUFF=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-pagestuff
+RANLIB=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-ranlib
+REDO_PREBINDING=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-redo_prebinding
+SEGEDIT=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-segedit
+SEG_ADDR_TABLE=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-seg_addr_table
+SEG_HACK=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-seg_hack
+SIZE=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-size
+STRINGS=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-strings
+STRIP=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-strip
+_PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_x86_64_apple_darwin13_4_0
INFO: activate_clangxx_osx-64.sh made the following environmental changes:
+CLANGXX=/Users/jespinoz/anaconda/envs/python3/bin/x86_64-apple-darwin13.4.0-clang++
+CXX=x86_64-apple-darwin13.4.0-clang++
+CXXFLAGS=-march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -std=c++14 -fmessage-length=0
+DEBUG_CXXFLAGS=-march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -std=c++14 -fmessage-length=0 -Og -g -Wall -Wextra
Run Code Online (Sandbox Code Playgroud)

以下是所pastebin请求的输出/脚本的链接:

正如Tarun Lalwani在评论中所建议的那样:

标准输出

bash -xlc"source activate python3"1> activate_output.o

标准错误

bash -xlc"source activate python3"2> activate_output.e

Trishansh Bhardwaj和Tarun Lalwani在评论中要求的脚本:

脚本

相关脚本

Tar*_*ani 3

如果您查看以下文件夹

/Users/jespinoz/anaconda/envs/python3/etc/conda
Run Code Online (Sandbox Code Playgroud)

里面有一个activate.dand文件夹,它会在和deactivate.d期间执行activatedeactivate

这些文件有以下代码部分

if [ $? -ne 0 ]; then
  echo "ERROR: $(_get_sourced_filename) failed, see above for details"
else
  if [ -f /tmp/new-env-$$.txt ]; then
    rm -f /tmp/new-env-$$.txt || true
  fi
  env > /tmp/new-env-$$.txt

  echo "INFO: $(_get_sourced_filename) made the following environmental changes:"
  diff -U 0 -rN /tmp/old-env-$$.txt /tmp/new-env-$$.txt | tail -n +4 | grep "^-.*\|^+.*" | grep -v "CONDA_BACKUP_" | sort
fi
rm -f /tmp/old-env-$$.txt /tmp/new-env-$$.txt || true
Run Code Online (Sandbox Code Playgroud)

您需要注释这些以禁用详细输出。该代码基本上将当前内容保存env到文件中,然后运行激活代码,env再次捕获并打印差异