【发布时间】:2017-07-25 16:04:28
【问题描述】:
我正在尝试安装 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
显然 distutils 出于某种原因使用了错误的 gcc 路径。然后,我尝试使用export CC=/correct/path/to/gcc 手动指定 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 or directory
原来有问题的命令现在使用了正确的路径,但它仍在尝试使用 gcc 的错误位置来构建共享库。我需要指定另一个环境变量来纠正这种行为吗?
【问题讨论】:
标签: python gcc setuptools distutils