python无法找到程序输入点openssl,致命错误:openssl / err.h:没有这样的文件或目录-Python...

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

| ^~~~~~~~~~~~~~~

compilation terminated.

error: command 'gcc' failed with exit status 1

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

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

| ^~~~~~~~~~~~~~~

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

| ^~~~~~~~~~~~~~~

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.

I am using python 3.7

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

sudo apt-get install python3-dev

Any solution?

UPDATE:

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值