【问题标题】:Installing M2Crypto 0.20.1 on Python 2.6 on Ubuntu 14.04在 Ubuntu 14.04 上的 Python 2.6 上安装 M2Crypto 0.20.1
【发布时间】:2014-05-27 17:11:11
【问题描述】:

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

但是,M2Crypto 的 setup.py install 失败如下:

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)

我可能会错过什么?

【问题讨论】:

  • swig 命令丢失 -I/usr/include/x86_64-linux-gnu/openssl/
  • 但是为什么?,文件在那里......
  • 不知道。我刚刚在我的 14.04 LTS、python 2.7 上完美地安装了 M2Crypto,并且它工作正常。那里的 swig 命令是 swig -python -I/usr/include/python2.7 -I/usr/include/x86_64-linux-gnu -I/usr/include -I/usr/include/openssl -includeall -modern -o SWIG/_m2crypto_wrap.c SWIG/_m2crypto.i
  • M2Crypto-0.22.3.tar.gz
  • 我要开始使用Python2.7了,谢谢@AnttiHaapala的帮助

标签: python ubuntu


【解决方案1】:

路径错误。尝试这样做:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-02-16
    • 2016-04-03
    • 2014-07-24
    • 2015-01-30
    • 2014-12-29
    • 2014-11-22
    • 2017-05-21
    相关资源
    最近更新 更多