我正在尝试在Conda环境中编译一些代码
以前安装了编译器软件包gcc_linux-64
。
但是,即使在停用并再次激活环境之后,gcc
仍然是/usr/bin/gcc
。
我应该怎么做才能使Conda像预期的那样工作。使用工具
我安装?就像其他软件一样,像git
或其他。
任何帮助将不胜感激,在此先感谢!
最佳答案
如果您这样做:
export CONDA_BUILD=1
conda activate <name-of-env-in-which-gcc_linux-64-is-installed>
你会看见:
INFO: activate-binutils_linux-64.sh made the following environmental changes:
+ADDR2LINE=/root/m3/envs/test/bin/x86_64-conda_cos6-linux-gnu-addr2line
+AR=/root/m3/envs/test/bin/x86_64-conda_cos6-linux-gnu-ar
+AS=/root/m3/envs/test/bin/x86_64-conda_cos6-linux-gnu-as
+CXXFILT=/root/m3/envs/test/bin/x86_64-conda_cos6-linux-gnu-c++filt
+ELFEDIT=/root/m3/envs/test/bin/x86_64-conda_cos6-linux-gnu-elfedit
+GPROF=/root/m3/envs/test/bin/x86_64-conda_cos6-linux-gnu-gprof
+LD=/root/m3/envs/test/bin/x86_64-conda_cos6-linux-gnu-ld
+LD_GOLD=/root/m3/envs/test/bin/x86_64-conda_cos6-linux-gnu-ld.gold
+NM=/root/m3/envs/test/bin/x86_64-conda_cos6-linux-gnu-nm
+OBJCOPY=/root/m3/envs/test/bin/x86_64-conda_cos6-linux-gnu-objcopy
+OBJDUMP=/root/m3/envs/test/bin/x86_64-conda_cos6-linux-gnu-objdump
+RANLIB=/root/m3/envs/test/bin/x86_64-conda_cos6-linux-gnu-ranlib
+READELF=/root/m3/envs/test/bin/x86_64-conda_cos6-linux-gnu-readelf
+SIZE=/root/m3/envs/test/bin/x86_64-conda_cos6-linux-gnu-size
+STRINGS=/root/m3/envs/test/bin/x86_64-conda_cos6-linux-gnu-strings
+STRIP=/root/m3/envs/test/bin/x86_64-conda_cos6-linux-gnu-strip
INFO: activate-gcc_linux-64.sh made the following environmental changes:
+CC=/root/m3/envs/test/bin/x86_64-conda_cos6-linux-gnu-cc
+CFLAGS=-march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -pipe -I/include -fdebug-prefix-map=${SRC_DIR}=/usr/local/src/conda/${PKG_NAME}-${PKG_VERSION} -fdebug-prefix-map=${PREFIX}=/usr/local/src/conda-prefix
+CPP=/root/m3/envs/test/bin/x86_64-conda_cos6-linux-gnu-cpp
+CPPFLAGS=-DNDEBUG -D_FORTIFY_SOURCE=2 -O2
+DEBUG_CFLAGS=-march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-all -fno-plt -Og -g -Wall -Wextra -fvar-tracking-assignments -pipe -I/include -fdebug-prefix-map=${SRC_DIR}=/usr/local/src/conda/${PKG_NAME}-${PKG_VERSION} -fdebug-prefix-map=${PREFIX}=/usr/local/src/conda-prefix
+DEBUG_CPPFLAGS=-D_DEBUG -D_FORTIFY_SOURCE=2 -Og
+GCC=/root/m3/envs/test/bin/x86_64-conda_cos6-linux-gnu-gcc
+GCC_AR=/root/m3/envs/test/bin/x86_64-conda_cos6-linux-gnu-gcc-ar
+GCC_NM=/root/m3/envs/test/bin/x86_64-conda_cos6-linux-gnu-gcc-nm
+GCC_RANLIB=/root/m3/envs/test/bin/x86_64-conda_cos6-linux-gnu-gcc-ranlib
+LDFLAGS=-Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,--disable-new-dtags -Wl,-rpath,/lib -L/lib
+_CONDA_PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_x86_64_conda_cos6_linux_gnu
在您的make文件中,您可以改用
$CC
之类的变量。关于gcc - Conda GCC不能替代系统GCC,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/53030539/