我需要在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安装失败如下:
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,'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)
我能错过什么?
解决方法
路径错了.尝试这样做:
cd /usr/include/openssl/ ln -s ../x86_64-linux-gnu/openssl/opensslconf.h .