“C扩展无法编译'错误。 - 安装Flask时

时间:2014-06-07 12:22:09

标签: python flask

我在debian 7上的virtualenv中安装flask时出现以下错误.apt-get-install告诉我我已经有了GCC。我尝试了apt-get install libpcre3-dev,但随后用pip install Flask-scss --force-reinstall -I重新安装了烧瓶,但仍然遇到了同样的错误。如何修复此问题以便使用加速?

错误:

markupsafe/_speedups.c:12:20: fatal error: Python.h: No such file or directory
compilation terminated.
==========================================================================
WARNING: The C extension could not be compiled, speedups are not enabled.
Failure information, if any, is above.
Retrying the build without the C extension now.


==========================================================================
WARNING: The C extension could not be compiled, speedups are not enabled.
Plain-Python installation succeeded.
==========================================================================

4 个答案:

答案 0 :(得分:37)

您也需要安装python-dev package;这取决于contains Python.h

的正确包裹
apt-get install python-dev

答案 1 :(得分:9)

sudo apt-get install python-dev

或者

 sudo apt-get install python3-dev for python3

答案 2 :(得分:1)

对于那些使用Amazon Web Services(AWS)的人。

按照this reference安装系统的开发工具链:

yum(亚马逊AMI,RedHat,Centos)

sudo yum groupinstall -y "Development Tools"

apt(Debian,Ubuntu,Mint)

sudo apt-get install -y build-essential

答案 3 :(得分:1)

当安装具有c扩展名的库时,这也是Windows上的常见问题。 Windows中的这个问题可以通过安装mingw来解决,它代表极简GNU for Windows

为anaconda安装mingw:

conda install mingw

要了解有关mingw的更多信息,请查看http://www.mingw.org/