2015-11-16 204 views
4

此错误消息不是未知的,我已经重新安装了许多软件包,但至今尚未找到解决方案。Python编译错误:“LONG_BIT定义对于平台出现错误”

我得到以下错误的命令pip install cryptography

/usr/include/python2.7/pyport.h:849:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)." 

#error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)." 

^ 

在长回溯它说的末尾:

distutils.errors.DistutilsError: Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 

---------------------------------------- 
Cleaning up... 
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-xXOpFq-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/cryptography 
Storing debug log for failure in /root/.pip/pip.log 

蟒蛇-dev的,python2.7-dev的和python3-dev的存在。

+0

请使用有意义的标题。你的说(从gobbledygook翻译)“有一个汇编错误”。 –

+0

在这个问题上,你需要跟踪定义'LONG_BIT'和'SIZEOF_LONG'的位置。应该引人入胜。对于64位系统,LONG_BIT应该是64,SIZEOF_LONG和sizeof(long)应该是8.LONG_BIT应该取决于limits.h中的LONG_MAX,并且应该定义SIZEOF_LONG在'pyconfig.h'中。 –

+0

“python3-dev exists”:除非使用'pip3'命令,否则不相关。 ...你的操作系统是未知的。可能是Ubuntu 15.10?不能是Debian 8:'cryptography'已经安装了'python-all-dev'。 ......只用五种不同的操作系统进行了一次“pip install cryptography”安装测试:完全没有问题。 ... –

回答

1

确保你已经为python安装了正确的位。 在我的情况下,我在我的64位centos上安装了32位的aaconda python,导致了这个问题。为Python安装正确的位版本修复了它。