安装bcrypt时'gcc-4.2'退出状态为1

1 投票
1 回答
1268 浏览
提问于 2025-04-17 13:07

大家好,我是新手,刚开始学习Django和Python。我正在尝试安装bcrypt,这是我运行一段Django代码所需要的,但遇到了问题,具体情况如下:

我使用的是Python 2.7和Django 1.4版本。

running build

running build_py

running build_ext

building 'bcrypt._bcrypt' extension

gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -isysroot /Developer/SDKs/MacOSX10.6.sdk -arch i386 -arch x86_64 -g -O2 -DNDEBUG -g -O3 -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c bcrypt/bcrypt_python.c -o build/temp.macosx-10.6-intel-2.7/bcrypt/bcrypt_python.o

In file included from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/unicodeobject.h:4,

                 from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:85,

                 from bcrypt/bcrypt_python.c:17:

/Developer/SDKs/MacOSX10.6.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory

In file included from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/unicodeobject.h:4,

from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:85,

from bcrypt/bcrypt_python.c:17:

/Developer/SDKs/MacOSX10.6.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory

lipo: can't figure out the architecture type of: /var/folders/2s/n9wb5x4534nfs1cbrlph32v00000gp/T//ccb7N3qq.out

error: command 'gcc-4.2' failed with exit status 1

----------------------------------------
Command /Users/Kinnovate/Downloads/dwaiter-django-bcrypt-913d86b/my_new_env/bin/python -c "import setuptools;__file__='/Users/Kinnovate/Downloads/dwaiter-django-bcrypt-913d86b/my_new_env/build/py-bcrypt/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /var/folders/2s/n9wb5x4534nfs1cbrlph32v00000gp/T/pip-yONWs2-record/install-record.txt --install-headers /Users/Kinnovate/Downloads/dwaiter-django-bcrypt-913d86b/my_new_env/bin/../include/site/python2.7 failed with error code 1

我该怎么解决这个问题呢?

1 个回答

1
/Developer/SDKs/MacOSX10.6.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory

我觉得 stdarg.h 是标准C库的一部分,可能是标准C++库 libstdc++ 的一部分。听起来像是 libstdc 这个库缺失了,或者编译器找不到它。

在网上搜索你的错误信息 (stdarg.h: No such file or directory) 会发现很多相关的讨论,像StackOverflow上就有很多。你可以看看 这里 或者 这里,这些地方似乎有针对你问题的解决办法。

撰写回答