我正在尝试安装 subprocess32 python 模块(https://github.com/google/python-subprocess32),但 distutils 遇到一些问题。该模块包含必须构建的 C 扩展,但是当我运行 或 时,pip install .我python setup.py install得到以下输出:
...
creating build
creating build/temp.linux-x86_64-2.7
/non/existent/path/gcc -pthread -fPIC ... -c _posixsubprocess.c -o build/temp.linux-x86_64-2.7/_posixsubprocess.o
unable to execute '/non/existent/path/gcc': No such file or directory
Run Code Online (Sandbox Code Playgroud)
显然,由于某种原因,distutils 使用了错误的 gcc 路径。然后我尝试使用手动指定 gcc 的正确路径export CC=/correct/path/to/gcc,得到以下输出:
building '_posixsubprocess' extension
creating build/temp.linux-x86_64-2.7
/correct/path/to/gcc -fPIC -fno-strict-aliasing -g -O2 ... -c _posixsubprocess.c -o build/temp.linux-x86_64-2.7/_posixsubprocess.o
/non/existent/path/gcc -pthread -shared ... build/temp.linux-x86_64-2.7/_posixsubprocess.o -o build/lib.linux-x86_64-2.7/_posixsubprocess.so
unable to execute '/non/existent/path/gcc': No such file …Run Code Online (Sandbox Code Playgroud)