The issue is the name of the gcc compiler that conda installs. Because it isn't just gcc
, it's some long complicated thing, eg. x86_64-conda_cos6-linux-gnu-gcc
, it won't override the system executable, even if your conda directory is earlier in your PATH
variable.
The solution is to softlink your conda gcc compiler into your local binary directory, eg. ln -s path/to/conda/gcc ~/.local/bin/gcc
, and then put that ahead of your system binary directory in your PATH
variable, eg. export PATH=$HOME/.local/bin:$PATH
where your shell is sourced, ie. ~/.bashrc
, ~/.bash_profile
, ~/.zshrc
, etc.
This will then point to your conda executable before the system one, and should have the appropriate name to override it.
Keep in mind that if you delete your environment, or replace / update the gcc installed in it, you will need to update the softlink accordingly. Unless you need lots of different gcc versions, I'd just install it to your base env, do the soft link, and don't touch it after that. Hacky, but it works.