I am running a gcc command via python's subprocess.run
as follows
cmdCompile="LD_LIBRARY_PATH=/usr/local/lib gcc foo.c"
subprocess.run(cmdCompile.split(' '), stdout=subprocess.PIPE, stderr=subprocess.PIPE,check=True)
I got an error saying
FileNotFoundError: [Errno 2] No such file or directory: 'LD_LIBRARY_PATH=/usr/local/lib'
Apparently, the first argument of subprocess should not start with a non-file. How can I work around it?