Skip to main content
 首页 » 编程设计

python之当我尝试安装 Flask-bcrypt 时它抛出错误 : command 'x86_64-linux-gnu-gcc' failed with exit status 1

2025年05月04日11lexus

当我尝试为我的应用程序安装 flask-bcrypt 库时,它抛出了这个错误:

创建构建/temp.linux-x86_64-2.7

creating build/temp.linux-x86_64-2.7/bcrypt 
 
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c bcrypt/bcrypt.c -o build/temp.linux-x86_64-2.7/bcrypt/bcrypt.o 
 
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c bcrypt/bcrypt_pbkdf.c -o build/temp.linux-x86_64-2.7/bcrypt/bcrypt_pbkdf.o 
 
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c bcrypt/bcrypt_python.c -o build/temp.linux-x86_64-2.7/bcrypt/bcrypt_python.o 
 
bcrypt/bcrypt_python.c:18:20: fatal error: Python.h: No such file or directory 
 
 #include "Python.h" 
^ 
 
compilation terminated. 
 
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 

如何解决?? -提前致谢!

请您参考如下方法:

如果您发现在安装 Python-dev 后遇到问题,请安装 Foreign 函数接口(interface)。那是我能够安装 brypt 的时候:

sudo apt-get install libffi-dev