【问题标题】:installing m2crypto in a docker container在 docker 容器中安装 m2crypto
【发布时间】:2019-06-07 01:13:12
【问题描述】:

尝试在 Dockerfile 中安装 m2crypto:

FROM python:3.7
RUN pip install m2crypto

我收到以下错误输出(截断):

Step 7/8 : RUN pip install m2crypto
 ---> Running in 1204096f1488
Collecting m2crypto
  Downloading https://files.pythonhosted.org/packages/23/93/1c1a887f956ec38d691af110d38059e234fc941019e0c074a66a10846813/M2Crypto-0.34.0.tar.gz (1.1MB)
Building wheels for collected packages: m2crypto
  Building wheel for m2crypto (setup.py): started
  Building wheel for m2crypto (setup.py): finished with status 'error'
  ERROR: Complete output from command /usr/local/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-ptf_nqd5/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-w9seu9sh --python-tag cp37:
  ERROR: running bdist_wheel
...
  gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include/python3.7m -I/tmp/pip-install-ptf_nqd5/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: In function ‘_wrap__STACK_num_set’:
  SWIG/_m2crypto_wrap.c:9506:19: error: dereferencing pointer to incomplete type ‘struct stack_st’
     if (arg1) (arg1)->num = arg2;
                     ^~
... lots more errors ...
ERROR: Command "/usr/local/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-ptf_nqd5/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-xq22_pd8/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-ptf_nqd5/m2crypto/

https://pastebin.com/3bmdGvdx 的完整输出。

我做错了吗?

【问题讨论】:

标签: python pip m2crypto


【解决方案1】:

按照installation instructions自行解决:

FROM python:3.7
RUN apt-get update
RUN apt-get install -y build-essential
RUN apt-get install -y python3-dev
RUN apt-get install -y swig
RUN pip install m2crypto

libssl-dev 在说明中提到但已经存在。 apt-get update 是必需的,否则将找不到 build-essential-y 是必需的,因为python3-dev 很大,否则apt-get install 会提示“您要安装吗?[Y/n]”。

我敢肯定,它的许多其他变体也可以使用其他基本图像。但这确实有效。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-11-11
    • 2017-05-02
    • 2014-07-06
    • 2020-12-20
    • 2021-05-11
    • 2021-07-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多