本文介绍了致命错误:openssl/err.h:没有这样的文件或目录-Python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试安装M2Crypto,但无法安装,出现以下错误:我在虚拟迷你康达环境中.

I try to install M2Crypto, but I can't install it, the error I have is the following:I am in a virtual miniconda environment.

building 'M2Crypto._m2crypto' extension
gcc -pthread -B /home/lcteen/miniconda3/envs/django/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/lcteen/miniconda3/envs/django/include/python3.7m -I/home/lcteen/Downloads/M2Crypto-0.35.2/SWIG -c SWIG/_m2crypto_wrap.c -o build/temp.linux-x86_64-3.7/SWIG/_m2crypto_wrap.o -DTHREADING -Wno-deprecated-declarations
SWIG/_m2crypto_wrap.c:3561:10: fatal error: openssl/err.h: No such file or directory
 3561 | #include <openssl/err.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1

我正在使用以下命令进行安装:python setup.py install

I am installing it with the following command: python setup.py install

通过pip安装它时,错误如下:

When installing it by pip, the error is as follows:

Collecting M2Crypto
  Using cached https://files.pythonhosted.org/packages/74/18/3beedd4ac48b52d1a4d12f2a8c5cf0ae342ce974859fba838cbbc1580249/M2Crypto-0.35.2.tar.gz
Building wheels for collected packages: M2Crypto
  Building wheel for M2Crypto (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/lcteen/miniconda3/envs/django/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-q5bgx0sr/M2Crypto/setup.py'"'"'; __file__='"'"'/tmp/pip-install-q5bgx0sr/M2Crypto/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-kjvnl1i1 --python-tag cp37
       cwd: /tmp/pip-install-q5bgx0sr/M2Crypto/
  Complete output (52 lines):
  running bdist_wheel
  running build
  running build_py
  copying M2Crypto/Engine.py -> build/lib.linux-x86_64-3.7/M2Crypto
  copying M2Crypto/RC4.py -> build/lib.linux-x86_64-3.7/M2Crypto
  copying M2Crypto/BIO.py -> build/lib.linux-x86_64-3.7/M2Crypto
  copying M2Crypto/m2.py -> build/lib.linux-x86_64-3.7/M2Crypto
  copying M2Crypto/m2urllib2.py -> build/lib.linux-x86_64-3.7/M2Crypto
  copying M2Crypto/BN.py -> build/lib.linux-x86_64-3.7/M2Crypto
  copying M2Crypto/util.py -> build/lib.linux-x86_64-3.7/M2Crypto
  copying M2Crypto/Err.py -> build/lib.linux-x86_64-3.7/M2Crypto
  copying M2Crypto/EC.py -> build/lib.linux-x86_64-3.7/M2Crypto
  copying M2Crypto/DSA.py -> build/lib.linux-x86_64-3.7/M2Crypto
  copying M2Crypto/EVP.py -> build/lib.linux-x86_64-3.7/M2Crypto
  copying M2Crypto/m2urllib.py -> build/lib.linux-x86_64-3.7/M2Crypto
  copying M2Crypto/httpslib.py -> build/lib.linux-x86_64-3.7/M2Crypto
  copying M2Crypto/callback.py -> build/lib.linux-x86_64-3.7/M2Crypto
  copying M2Crypto/m2xmlrpclib.py -> build/lib.linux-x86_64-3.7/M2Crypto
  copying M2Crypto/RSA.py -> build/lib.linux-x86_64-3.7/M2Crypto
  copying M2Crypto/threading.py -> build/lib.linux-x86_64-3.7/M2Crypto
  copying M2Crypto/__init__.py -> build/lib.linux-x86_64-3.7/M2Crypto
  copying M2Crypto/m2crypto.py -> build/lib.linux-x86_64-3.7/M2Crypto
  copying M2Crypto/X509.py -> build/lib.linux-x86_64-3.7/M2Crypto
  copying M2Crypto/ftpslib.py -> build/lib.linux-x86_64-3.7/M2Crypto
  copying M2Crypto/Rand.py -> build/lib.linux-x86_64-3.7/M2Crypto
  copying M2Crypto/AuthCookie.py -> build/lib.linux-x86_64-3.7/M2Crypto
  copying M2Crypto/ASN1.py -> build/lib.linux-x86_64-3.7/M2Crypto
  copying M2Crypto/SMIME.py -> build/lib.linux-x86_64-3.7/M2Crypto
  copying M2Crypto/six.py -> build/lib.linux-x86_64-3.7/M2Crypto
  copying M2Crypto/DH.py -> build/lib.linux-x86_64-3.7/M2Crypto
  creating build/lib.linux-x86_64-3.7/M2Crypto/SSL
  copying M2Crypto/SSL/Cipher.py -> build/lib.linux-x86_64-3.7/M2Crypto/SSL
  copying M2Crypto/SSL/ssl_dispatcher.py -> build/lib.linux-x86_64-3.7/M2Crypto/SSL
  copying M2Crypto/SSL/timeout.py -> build/lib.linux-x86_64-3.7/M2Crypto/SSL
  copying M2Crypto/SSL/SSLServer.py -> build/lib.linux-x86_64-3.7/M2Crypto/SSL
  copying M2Crypto/SSL/cb.py -> build/lib.linux-x86_64-3.7/M2Crypto/SSL
  copying M2Crypto/SSL/Context.py -> build/lib.linux-x86_64-3.7/M2Crypto/SSL
  copying M2Crypto/SSL/Checker.py -> build/lib.linux-x86_64-3.7/M2Crypto/SSL
  copying M2Crypto/SSL/TwistedProtocolWrapper.py -> build/lib.linux-x86_64-3.7/M2Crypto/SSL
  copying M2Crypto/SSL/__init__.py -> build/lib.linux-x86_64-3.7/M2Crypto/SSL
  copying M2Crypto/SSL/Session.py -> build/lib.linux-x86_64-3.7/M2Crypto/SSL
  copying M2Crypto/SSL/Connection.py -> build/lib.linux-x86_64-3.7/M2Crypto/SSL
  running build_ext
  building 'M2Crypto._m2crypto' extension
  creating build/temp.linux-x86_64-3.7
  creating build/temp.linux-x86_64-3.7/SWIG
  gcc -pthread -B /home/lcteen/miniconda3/envs/django/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/lcteen/miniconda3/envs/django/include/python3.7m -I/tmp/pip-install-q5bgx0sr/M2Crypto/SWIG -c SWIG/_m2crypto_wrap.c -o build/temp.linux-x86_64-3.7/SWIG/_m2crypto_wrap.o -Wno-deprecated-declarations -DTHREADING
  SWIG/_m2crypto_wrap.c:3561:10: fatal error: openssl/err.h: No such file or directory
   3561 | #include <openssl/err.h>
        |          ^~~~~~~~~~~~~~~
  compilation terminated.
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for M2Crypto
  Running setup.py clean for M2Crypto
Failed to build M2Crypto
Installing collected packages: M2Crypto
    Running setup.py install for M2Crypto ... error
    ERROR: Command errored out with exit status 1:
     command: /home/lcteen/miniconda3/envs/django/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-q5bgx0sr/M2Crypto/setup.py'"'"'; __file__='"'"'/tmp/pip-install-q5bgx0sr/M2Crypto/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-8ojxmrjt/install-record.txt --single-version-externally-managed --compile
         cwd: /tmp/pip-install-q5bgx0sr/M2Crypto/
    Complete output (55 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.7
    creating build/lib.linux-x86_64-3.7/M2Crypto
    copying M2Crypto/Engine.py -> build/lib.linux-x86_64-3.7/M2Crypto
    copying M2Crypto/RC4.py -> build/lib.linux-x86_64-3.7/M2Crypto
    copying M2Crypto/BIO.py -> build/lib.linux-x86_64-3.7/M2Crypto
    copying M2Crypto/m2.py -> build/lib.linux-x86_64-3.7/M2Crypto
    copying M2Crypto/m2urllib2.py -> build/lib.linux-x86_64-3.7/M2Crypto
    copying M2Crypto/BN.py -> build/lib.linux-x86_64-3.7/M2Crypto
    copying M2Crypto/util.py -> build/lib.linux-x86_64-3.7/M2Crypto
    copying M2Crypto/Err.py -> build/lib.linux-x86_64-3.7/M2Crypto
    copying M2Crypto/EC.py -> build/lib.linux-x86_64-3.7/M2Crypto
    copying M2Crypto/DSA.py -> build/lib.linux-x86_64-3.7/M2Crypto
    copying M2Crypto/EVP.py -> build/lib.linux-x86_64-3.7/M2Crypto
    copying M2Crypto/m2urllib.py -> build/lib.linux-x86_64-3.7/M2Crypto
    copying M2Crypto/httpslib.py -> build/lib.linux-x86_64-3.7/M2Crypto
    copying M2Crypto/callback.py -> build/lib.linux-x86_64-3.7/M2Crypto
    copying M2Crypto/m2xmlrpclib.py -> build/lib.linux-x86_64-3.7/M2Crypto
    copying M2Crypto/RSA.py -> build/lib.linux-x86_64-3.7/M2Crypto
    copying M2Crypto/threading.py -> build/lib.linux-x86_64-3.7/M2Crypto
    copying M2Crypto/__init__.py -> build/lib.linux-x86_64-3.7/M2Crypto
    copying M2Crypto/m2crypto.py -> build/lib.linux-x86_64-3.7/M2Crypto
    copying M2Crypto/X509.py -> build/lib.linux-x86_64-3.7/M2Crypto
    copying M2Crypto/ftpslib.py -> build/lib.linux-x86_64-3.7/M2Crypto
    copying M2Crypto/Rand.py -> build/lib.linux-x86_64-3.7/M2Crypto
    copying M2Crypto/AuthCookie.py -> build/lib.linux-x86_64-3.7/M2Crypto
    copying M2Crypto/ASN1.py -> build/lib.linux-x86_64-3.7/M2Crypto
    copying M2Crypto/SMIME.py -> build/lib.linux-x86_64-3.7/M2Crypto
    copying M2Crypto/six.py -> build/lib.linux-x86_64-3.7/M2Crypto
    copying M2Crypto/DH.py -> build/lib.linux-x86_64-3.7/M2Crypto
    creating build/lib.linux-x86_64-3.7/M2Crypto/SSL
    copying M2Crypto/SSL/Cipher.py -> build/lib.linux-x86_64-3.7/M2Crypto/SSL
    copying M2Crypto/SSL/ssl_dispatcher.py -> build/lib.linux-x86_64-3.7/M2Crypto/SSL
    copying M2Crypto/SSL/timeout.py -> build/lib.linux-x86_64-3.7/M2Crypto/SSL
    copying M2Crypto/SSL/SSLServer.py -> build/lib.linux-x86_64-3.7/M2Crypto/SSL
    copying M2Crypto/SSL/cb.py -> build/lib.linux-x86_64-3.7/M2Crypto/SSL
    copying M2Crypto/SSL/Context.py -> build/lib.linux-x86_64-3.7/M2Crypto/SSL
    copying M2Crypto/SSL/Checker.py -> build/lib.linux-x86_64-3.7/M2Crypto/SSL
    copying M2Crypto/SSL/TwistedProtocolWrapper.py -> build/lib.linux-x86_64-3.7/M2Crypto/SSL
    copying M2Crypto/SSL/__init__.py -> build/lib.linux-x86_64-3.7/M2Crypto/SSL
    copying M2Crypto/SSL/Session.py -> build/lib.linux-x86_64-3.7/M2Crypto/SSL
    copying M2Crypto/SSL/Connection.py -> build/lib.linux-x86_64-3.7/M2Crypto/SSL
    running build_ext
    building 'M2Crypto._m2crypto' extension
    creating build/temp.linux-x86_64-3.7
    creating build/temp.linux-x86_64-3.7/SWIG
    gcc -pthread -B /home/lcteen/miniconda3/envs/django/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/lcteen/miniconda3/envs/django/include/python3.7m -I/tmp/pip-install-q5bgx0sr/M2Crypto/SWIG -c SWIG/_m2crypto_wrap.c -o build/temp.linux-x86_64-3.7/SWIG/_m2crypto_wrap.o -Wno-deprecated-declarations -DTHREADING
    SWIG/_m2crypto_wrap.c:3561:10: fatal error: openssl/err.h: No such file or directory
     3561 | #include <openssl/err.h>
          |          ^~~~~~~~~~~~~~~
    compilation terminated.
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/lcteen/miniconda3/envs/django/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-q5bgx0sr/M2Crypto/setup.py'"'"'; __file__='"'"'/tmp/pip-install-q5bgx0sr/M2Crypto/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-8ojxmrjt/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.


我正在使用python 3.7


I am using python 3.7

我已经执行了以下命令,但仍然无法安装它:

I already executed the following command and still can't install it:

sudo apt-get install python3-dev

有解决方案吗?

更新:

调查该错误,我发现以下命令可以解决该问题:

Investigate the error and I saw that the following command could solve it:

sudo apt-get install libssl-dev

我运行了它,但仍然无法安装它,但是错误有所不同.错误:

I ran it and I still can't install it, but the error is different. Error:

SWIG/_m2crypto_wrap.c:31130:5: note: (near initialization for ‘SwigPyBuiltin___cbd_t_type.as_mapping’)
    SWIG/_m2crypto_wrap.c:31134:5: warning: excess elements in struct initializer
    31134 |     (objobjproc) 0,                           /* sq_contains */
          |     ^
    SWIG/_m2crypto_wrap.c:31134:5: note: (near initialization for ‘SwigPyBuiltin___cbd_t_type.as_mapping’)
    SWIG/_m2crypto_wrap.c:31135:5: warning: excess elements in struct initializer
    31135 |     (binaryfunc) 0,                           /* sq_inplace_concat */
          |     ^
    SWIG/_m2crypto_wrap.c:31135:5: note: (near initialization for ‘SwigPyBuiltin___cbd_t_type.as_mapping’)
    SWIG/_m2crypto_wrap.c:31136:5: warning: excess elements in struct initializer
    31136 |     (ssizeargfunc) 0,                         /* sq_inplace_repeat */
          |     ^
    SWIG/_m2crypto_wrap.c:31136:5: note: (near initialization for ‘SwigPyBuiltin___cbd_t_type.as_mapping’)
    SWIG/_m2crypto_wrap.c:31146:5: warning: initialization of ‘Py_ssize_t (*)(PyObject *)’ {aka ‘long int (*)(struct _object *)’} from incompatible pointer type ‘int (*)(PyObject *, Py_buffer *, int)’ {aka ‘int (*)(struct _object *, struct bufferinfo *, int)’} [-Wincompatible-pointer-types]
    31146 |     (getbufferproc) 0,                        /* bf_getbuffer */
          |     ^
    SWIG/_m2crypto_wrap.c:31146:5: note: (near initialization for ‘SwigPyBuiltin___cbd_t_type.as_sequence.sq_length’)
    SWIG/_m2crypto_wrap.c:31147:5: warning: initialization of ‘PyObject * (*)(PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *)’} from incompatible pointer type ‘void (*)(PyObject *, Py_buffer *)’ {aka ‘void (*)(struct _object *, struct bufferinfo *)’} [-Wincompatible-pointer-types]
    31147 |     (releasebufferproc) 0,                    /* bf_releasebuffer */
          |     ^
    SWIG/_m2crypto_wrap.c:31147:5: note: (near initialization for ‘SwigPyBuiltin___cbd_t_type.as_sequence.sq_concat’)
    SWIG/_m2crypto_wrap.c:31150:5: warning: initialization of ‘int (*)(PyObject *, Py_buffer *, int)’ {aka ‘int (*)(struct _object *, struct bufferinfo *, int)’} from incompatible pointer type ‘PyObject *’ {aka ‘struct _object *’} [-Wincompatible-pointer-types]
    31150 |     (PyObject*) 0,                            /* ht_name */
          |     ^
    SWIG/_m2crypto_wrap.c:31150:5: note: (near initialization for ‘SwigPyBuiltin___cbd_t_type.as_buffer.bf_getbuffer’)
    SWIG/_m2crypto_wrap.c:31151:5: warning: initialization of ‘void (*)(PyObject *, Py_buffer *)’ {aka ‘void (*)(struct _object *, struct bufferinfo *)’} from incompatible pointer type ‘PyObject *’ {aka ‘struct _object *’} [-Wincompatible-pointer-types]
    31151 |     (PyObject*) 0,                            /* ht_slots */
          |     ^
    SWIG/_m2crypto_wrap.c:31151:5: note: (near initialization for ‘SwigPyBuiltin___cbd_t_type.as_buffer.bf_releasebuffer’)
    SWIG/_m2crypto_wrap.c:30993:54: warning: missing braces around initializer [-Wmissing-braces]
    30993 | static PyHeapTypeObject SwigPyBuiltin___cbd_t_type = {
          |                                                      ^
    ......
    31150 |     (PyObject*) 0,                            /* ht_name */
          |     {
    31151 |     (PyObject*) 0,                            /* ht_slots */
    31152 | };
          | }
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/lcteen/miniconda3/envs/django/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-o4e0dlzd/M2Crypto/setup.py'"'"'; __file__='"'"'/tmp/pip-install-o4e0dlzd/M2Crypto/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-lntmgt5e/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.

(由于错误时间很长,我没有把所有错误都放在这里)

(I did not put all the error since it is very long)

推荐答案

该问题的解决方案是运行以​​下命令:

The solution to the problem was to run the following command:

conda install -c conda-forge m2crypto

这篇关于致命错误:openssl/err.h:没有这样的文件或目录-Python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 14:09
查看更多