我尝试安装M2Crypto,但无法安装,错误如下: 我在一个虚拟的微型环境中。在
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
用pip安装时,错误如下:
^{pr2}$我使用的是python3.7
我已经执行了以下命令,但仍然无法安装:
sudo apt-get install python3-dev
有什么解决办法吗?在
更新:
调查错误,我发现以下命令可以解决它:
sudo apt-get install libssl-dev
我运行它,我仍然无法安装它,但错误是不同的。错误:
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.
(我没有把所有的错误,因为它很长)
解决此问题的方法是运行以下命令:
相关问题 更多 >
编程相关推荐