Python compilation error: LONG_BIT definition appears wrong for platform

2024/11/15 19:36:06

This error message is not unknown, I have already reinstalled many packages, but so far not yet found a solution.

I get the following error from the command 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?)."^

At the end of a long traceback it says:

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

python-dev, python2.7-dev and python3-dev exist.

Answer

Make sure you have the right bits-installed for python. In my case I installed anaconda python 32-bit on my 64-bit centOs which caused the issue. Installing the right bit version for Python fixed it.

https://en.xdnf.cn/q/71754.html

Related Q&A

Randomly sampling lines from a file

I have a csv file which is ~40gb and 1800000 lines. I want to randomly sample 10,000 lines and print them to a new file.Right now, my approach is to use sed as:(sed -n $vars < input.txt) > output…

Is Pythons hashlib.sha256(x).hexdigest() equivalent to Rs digest(x,algo=sha256)

Im not a python programmer, but Im trying to translate some Python code to R. The piece of python code Im having trouble with is:hashlib.sha256(x).hexdigest()My interpretation of this code is that the…

How to do Histogram Equalization on specific area

I have a image and I want to do HE or CLAHE on specific area of the image. I already have a mask for the image. Is there any possible way to do so?

Timing out a multiprocessing function

I need to set a time limit on a python function which use some multiprocessing stuff (I dont know if it matters). Something like this:function(a_list):p1 = Process(a_list[0:len(a_list/2)])p2 = Process(…

How can I get the actual axis limits when using ax.axis(equal)?

I am using ax.axes(equal) to make the axis spacing equal on X and Y, and also setting xlim and ylim. This over-constrains the problem and the actual limits are not what I set in ax.set_xlim() or ax.set…

Python rarfile package: fail to open files

So I was trying to archive a .rar file using rarfile library in Python, but it keeps saying "failed to open". Am using Mac OS X El Capitan, python 2.7. Any help would be appreciated, thanks.O…

Sublime Text 3 Python Interactive Console? [duplicate]

This question already has answers here:Cant send input to running program in Sublime Text(5 answers)Closed 7 years ago.I have been using a lot of sublime text 3 to write python. However, whenever a pro…

Is there any value to a Switch / Case implementation in Python?

Recently, I saw some discussions online about how there is no good "switch / case" equivalent in Python. I realize that there are several ways to do something similar - some with lambda, som…

Replacing the existing MainWindow with a new window with Python, PyQt, Qt Designer

Im new to Python GUI programming Im have trouble making a GUI app. I have a main window with only a button widget on it. What i want to know is how to replace the existing window with a new window when…

Using LaTeX Beamer to display code

Im using the following LaTeX code in a Beamer presentation:\begin{frame}\begin{figure}\centering\tiny\lstset{language=python}\lstinputlisting{code/get_extent.py}\end{figure} \end{frame}Is it possible t…