“致命错误:openssl / opensslv.h:没有这样的文件或目录”编译mitmproxy

Modified on: Sat, 09 Jun 2018 12:09:53 +0800

我正在尝试通过像这样的pip来安装mitmproxy包:

$ sudo pip install mitmproxy

终止时出现以下错误消息:

x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c build/temp.linux-x86_64-2.7/_openssl.c -o build/temp.linux-x86_64-2.7/build/temp.linux-x86_64-2.7/_openssl.o

build/temp.linux-x86_64-2.7/_openssl.c:391:30: fatal error: openssl/opensslv.h: No such file or directory

compilation terminated.

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------
  Can't roll back cryptography; was not uninstalled
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-jvLTVf/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-DrY4DI-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip-build-jvLTVf/cryptography
Storing debug log for failure in /home/niklas/.pip/pip.log

在此之后它有点安装,至少我可以在之后卸载它。

 $ mitmproxy

导致

Traceback (most recent call last):
  File "/usr/local/bin/mitmproxy", line 7, in <module>
    from mitmproxy.main import mitmproxy
  File "/usr/local/lib/python2.7/dist-packages/mitmproxy/main.py", line 7, in <module>
    from . import version, cmdline
  File "/usr/local/lib/python2.7/dist-packages/mitmproxy/cmdline.py", line 6, in <module>
    import configargparse
ImportError: No module named configargparse
作者:terdon,Niklas

最佳答案

其他答案仅解决依赖关系,以使您提到的错误消失。所需的所有依赖项列表实际上要长得多。

您可以使用以下方式安装它们:

sudo apt-get install python-pip python-dev libffi-dev libssl-dev libxml2-dev libxslt1-dev libjpeg8-dev zlib1g-dev

然后你可以安装mitmproxy

sudo pip install mitmproxy

然后运行它:

mitmproxy

来源:文档

作者:grooveplex

相关问答

添加新评论