I am trying to install cupy 5.0.0. cupy5.0.0 needs gcc version not more than 7. My deafault gcc is gcc-9. I cannot use conda environment. Also i dont have sudo permission to change /usr/bin/gcc to point to gcc-7. Is there any way to pass gcc path to pip command?
Asked
Active
Viewed 7,005 times
3
-
`PATH=/usr/loca/bin:$PATH pip install …` `/usr/loca/bin` is just an example; it must be a directory where your alternative `gcc` resides. – phd Apr 03 '20 at 17:49
1 Answers
6
You can use CXX
, CC
and LD
environment variables to specify executable names or full paths to C++ and C compilers, and the linker.
Specify the variables only for one command:
CXX=g++-7 CC=gcc-7 LD=g++-7 pip install ...
Alternatively:
export CXX=g++-7
export CC=gcc-7
export LD=g++-7
pip install ...
You can also pass extra compiler and linker options in CXXFLAGS
, CFLAGS
, LDFLAGS
. Preprocessor options (e.g. include directories) go in CPPFLAGS
.

Maxim Egorushkin
- 131,725
- 17
- 180
- 271
-
Thanks. That works. Is it possible to specify cuda_host_compiler also for nvcc? In the process of installation somewhere it is using the cuda_host_compiler as the default one. – Bhaswati Saha Apr 04 '20 at 15:43
-
@BhaswatiSaha You can use this method to pass any environment variables to `pip`, but you need to find out which environment variable controls that. – Maxim Egorushkin Apr 04 '20 at 16:09