本文介绍了在 Ubuntu 14.04 上的 Python 2.6 上安装 M2Crypto 0.20.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在 Ubuntu 14.04 上从 Python 2.6 的源代码编译和安装 M2Crypto 0.20.1.我现在无法迁移到 Python2.7,但我们正在计划.我从 https://launchpad.net/~fkrull/+archive/deadsnakes.我已经安装了 libssl-dev 和 python2.6-dev,文件/usr/include/x86_64-linux-gnu/openssl/opensslconf.h 有 644 作为权限,并且由 root 拥有.

I need to compile and install M2Crypto 0.20.1 from source for Python 2.6 on Ubuntu 14.04. I can't migrate to Python2.7 right now but we're planning so. I installed Python2.6 from https://launchpad.net/~fkrull/+archive/deadsnakes. I have installed libssl-dev and python2.6-dev, file /usr/include/x86_64-linux-gnu/openssl/opensslconf.h has 644 as permissions and is owned by root.

然而,M2Crypto 的 setup.py install 失败如下:

However the setup.py install for M2Crypto fails as below:

Running setup.py install for M2Crypto
    building 'M2Crypto.__m2crypto' extension
    swigging SWIG/_m2crypto.i to SWIG/_m2crypto_wrap.c
    swig -python -I/usr/include/python2.6 -I/usr/include -includeall -o SWIG/_m2crypto_wrap.c SWIG/_m2crypto.i
    SWIG/_evp.i:9: Error: Unable to find 'openssl/opensslconf.h'
    SWIG/_ec.i:7: Error: Unable to find 'openssl/opensslconf.h'
    error: command 'swig' failed with exit status 1
    Complete output from command /vagrant/venv/bin/python2.6 -c "import setuptools, tokenize;__file__='/vagrant/venv/build/M2Crypto/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-3vnOUl-record/install-record.txt --single-version-externally-managed --compile --install-headers /vagrant/venv/include/site/python2.6:
    running install

running build

running build_py

creating build

creating build/lib.linux-x86_64-2.6

creating build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/RC4.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/BIO.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/callback.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/DSA.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/ftpslib.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/Engine.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/EVP.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/BN.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/DH.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/util.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/EC.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/httpslib.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/Rand.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/__init__.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/m2.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/m2xmlrpclib.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/RSA.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/threading.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/ASN1.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/SMIME.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/m2urllib2.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/Err.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/X509.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/AuthCookie.py -> build/lib.linux-x86_64-2.6/M2Crypto

copying M2Crypto/m2urllib.py -> build/lib.linux-x86_64-2.6/M2Crypto

creating build/lib.linux-x86_64-2.6/M2Crypto/SSL

copying M2Crypto/SSL/Session.py -> build/lib.linux-x86_64-2.6/M2Crypto/SSL

copying M2Crypto/SSL/Cipher.py -> build/lib.linux-x86_64-2.6/M2Crypto/SSL

copying M2Crypto/SSL/Connection.py -> build/lib.linux-x86_64-2.6/M2Crypto/SSL

copying M2Crypto/SSL/Checker.py -> build/lib.linux-x86_64-2.6/M2Crypto/SSL

copying M2Crypto/SSL/__init__.py -> build/lib.linux-x86_64-2.6/M2Crypto/SSL

copying M2Crypto/SSL/TwistedProtocolWrapper.py -> build/lib.linux-x86_64-2.6/M2Crypto/SSL

copying M2Crypto/SSL/SSLServer.py -> build/lib.linux-x86_64-2.6/M2Crypto/SSL

copying M2Crypto/SSL/Context.py -> build/lib.linux-x86_64-2.6/M2Crypto/SSL

copying M2Crypto/SSL/timeout.py -> build/lib.linux-x86_64-2.6/M2Crypto/SSL

copying M2Crypto/SSL/cb.py -> build/lib.linux-x86_64-2.6/M2Crypto/SSL

copying M2Crypto/SSL/ssl_dispatcher.py -> build/lib.linux-x86_64-2.6/M2Crypto/SSL

creating build/lib.linux-x86_64-2.6/M2Crypto/PGP

copying M2Crypto/PGP/PublicKey.py -> build/lib.linux-x86_64-2.6/M2Crypto/PGP

copying M2Crypto/PGP/__init__.py -> build/lib.linux-x86_64-2.6/M2Crypto/PGP

copying M2Crypto/PGP/RSA.py -> build/lib.linux-x86_64-2.6/M2Crypto/PGP

copying M2Crypto/PGP/PublicKeyRing.py -> build/lib.linux-x86_64-2.6/M2Crypto/PGP

copying M2Crypto/PGP/packet.py -> build/lib.linux-x86_64-2.6/M2Crypto/PGP

copying M2Crypto/PGP/constants.py -> build/lib.linux-x86_64-2.6/M2Crypto/PGP

running build_ext

building 'M2Crypto.__m2crypto' extension

swigging SWIG/_m2crypto.i to SWIG/_m2crypto_wrap.c

swig -python -I/usr/include/python2.6 -I/usr/include -includeall -o SWIG/_m2crypto_wrap.c SWIG/_m2crypto.i

SWIG/_evp.i:9: Error: Unable to find 'openssl/opensslconf.h'

SWIG/_ec.i:7: Error: Unable to find 'openssl/opensslconf.h'

error: command 'swig' failed with exit status 1

----------------------------------------
Cleaning up...
Command /vagrant/venv/bin/python2.6 -c "import setuptools, tokenize;__file__='/vagrant/venv/build/M2Crypto/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-3vnOUl-record/install-record.txt --single-version-externally-managed --compile --install-headers /vagrant/venv/include/site/python2.6 failed with error code 1 in /vagrant/venv/build/M2Crypto
Traceback (most recent call last):
  File "/vagrant/venv/bin/pip", line 11, in <module>
    sys.exit(main())
  File "/vagrant/venv/lib/python2.6/site-packages/pip/__init__.py", line 185, in main
    return command.main(cmd_args)
  File "/vagrant/venv/lib/python2.6/site-packages/pip/basecommand.py", line 161, in main
    text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 39: ordinal not in range(128)

我会遗漏什么?

推荐答案

路径错误.尝试这样做:

The path is wrong. Try to do this:

cd /usr/include/openssl/
ln -s ../x86_64-linux-gnu/openssl/opensslconf.h .

这篇关于在 Ubuntu 14.04 上的 Python 2.6 上安装 M2Crypto 0.20.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!