如何在 conda 中使用作業系統提供的工具鏈?

如何在 conda 中使用作業系統提供的工具鏈?

在 Ubuntu 18.04 上我運行which gcc並且輸出符合預期。

ubuntu@USER1:~$ which gcc
/usr/bin/gcc

但是,當我激活conda環境並運行時which gcc,我得到:

(tensorflow_p36) ubuntu@USER1:~$ which gcc
/home/ubuntu/anaconda3/envs/tensorflow_p36/bin/gcc

這個位置對我來說似乎很奇怪。我想在正常的系統範圍內使用gcc

我知道這不是預設行為,就像在我的其他 Ubuntu 實例中一樣,當我運行輸出時,which gcc輸出是正確的:

(tensorflow_p36) ubuntu@USER2:~$ which gcc
/usr/bin/gcc

我怎樣才能conda使用gcc如圖所示的預設值USER2


編輯:

USER1實例:conda 4.5.12

(tensorflow_p36) ubuntu@USER1:~$ gcc -v
Reading specs from /home/ubuntu/anaconda3/envs/tensorflow_p36/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.8.5/specs
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/ubuntu/anaconda3/envs/tensorflow_p36/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.8.5/lto-wrapper
Target: x86_64-unknown-linux-gnu
Thread model: posix 
gcc version 4.8.5 (GCC)

ubuntu@USER1:~$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/8/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Thread model: posix
gcc version 8.3.0 (Ubuntu 8.3.0-6ubuntu1~18.04.1) 

相關內容