在python3 安装M2Crypto时提示错误,具体错误内容太多了,放在后面了
解决方案:
由于OSX升级之后连 /usr/include 都没有了,使用命令
xcode-select --install
安装xcode命令行工具,多装几次/usr/include就会回来
然而里面还是没有 openssl
然后另外安装openssl 的时候会发现并没有把头文件ln到 /usr/include 里面,无卵用,/usr/include 还是一个不可更改的系统目录
但是我们留意到安装M2Crypto的时候报错的地方是提示 swig 语句有问题,于是可以修改swig 的寻址路径,如下,妥了:
sudo env LDFLAGS="-L$(brew --prefix openssl)/lib" \
CFLAGS="-I$(brew --prefix openssl)/include" \
SWIG_FEATURES="-cpperraswarn -includeall -I$(brew --prefix openssl)/include" \
pip install m2crypto
错误提示:
ERROR: Complete output from command /usr/local/bin/python3 -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/cf/dlw4k_s94gx_8d9641fytz5w0000gn/T/pip-install-5bj570na/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 /private/var/folders/cf/dlw4k_s94gx_8d9641fytz5w0000gn/T/pip-record-ereao77x/install-record.txt --single-version-externally-managed --compile:
ERROR: running install
running build
running build_py
copying M2Crypto/callback.py -> build/lib.macosx-10.6-intel-3.6/M2Crypto
copying M2Crypto/EVP.py -> build/lib.macosx-10.6-intel-3.6/M2Crypto
copying M2Crypto/AuthCookie.py -> build/lib.macosx-10.6-intel-3.6/M2Crypto
copying M2Crypto/m2.py -> build/lib.macosx-10.6-intel-3.6/M2Crypto
copying M2Crypto/ftpslib.py -> build/lib.macosx-10.6-intel-3.6/M2Crypto
copying M2Crypto/EC.py -> build/lib.macosx-10.6-intel-3.6/M2Crypto
copying M2Crypto/httpslib.py -> build/lib.macosx-10.6-intel-3.6/M2Crypto
copying M2Crypto/X509.py -> build/lib.macosx-10.6-intel-3.6/M2Crypto
copying M2Crypto/util.py -> build/lib.macosx-10.6-intel-3.6/M2Crypto
copying M2Crypto/RSA.py -> build/lib.macosx-10.6-intel-3.6/M2Crypto
copying M2Crypto/BIO.py -> build/lib.macosx-10.6-intel-3.6/M2Crypto
copying M2Crypto/DH.py -> build/lib.macosx-10.6-intel-3.6/M2Crypto
copying M2Crypto/__init__.py -> build/lib.macosx-10.6-intel-3.6/M2Crypto
copying M2Crypto/threading.py -> build/lib.macosx-10.6-intel-3.6/M2Crypto
copying M2Crypto/Rand.py -> build/lib.macosx-10.6-intel-3.6/M2Crypto
copying M2Crypto/SMIME.py -> build/lib.macosx-10.6-intel-3.6/M2Crypto
copying M2Crypto/Engine.py -> build/lib.macosx-10.6-intel-3.6/M2Crypto
copying M2Crypto/m2xmlrpclib.py -> build/lib.macosx-10.6-intel-3.6/M2Crypto
copying M2Crypto/RC4.py -> build/lib.macosx-10.6-intel-3.6/M2Crypto
copying M2Crypto/m2urllib2.py -> build/lib.macosx-10.6-intel-3.6/M2Crypto
copying M2Crypto/DSA.py -> build/lib.macosx-10.6-intel-3.6/M2Crypto
copying M2Crypto/six.py -> build/lib.macosx-10.6-intel-3.6/M2Crypto
copying M2Crypto/m2urllib.py -> build/lib.macosx-10.6-intel-3.6/M2Crypto
copying M2Crypto/BN.py -> build/lib.macosx-10.6-intel-3.6/M2Crypto
copying M2Crypto/m2crypto.py -> build/lib.macosx-10.6-intel-3.6/M2Crypto
copying M2Crypto/Err.py -> build/lib.macosx-10.6-intel-3.6/M2Crypto
copying M2Crypto/ASN1.py -> build/lib.macosx-10.6-intel-3.6/M2Crypto
creating build/lib.macosx-10.6-intel-3.6/M2Crypto/SSL
copying M2Crypto/SSL/cb.py -> build/lib.macosx-10.6-intel-3.6/M2Crypto/SSL
copying M2Crypto/SSL/Session.py -> build/lib.macosx-10.6-intel-3.6/M2Crypto/SSL
copying M2Crypto/SSL/timeout.py -> build/lib.macosx-10.6-intel-3.6/M2Crypto/SSL
copying M2Crypto/SSL/__init__.py -> build/lib.macosx-10.6-intel-3.6/M2Crypto/SSL
copying M2Crypto/SSL/TwistedProtocolWrapper.py -> build/lib.macosx-10.6-intel-3.6/M2Crypto/SSL
copying M2Crypto/SSL/Cipher.py -> build/lib.macosx-10.6-intel-3.6/M2Crypto/SSL
copying M2Crypto/SSL/Connection.py -> build/lib.macosx-10.6-intel-3.6/M2Crypto/SSL
copying M2Crypto/SSL/Context.py -> build/lib.macosx-10.6-intel-3.6/M2Crypto/SSL
copying M2Crypto/SSL/SSLServer.py -> build/lib.macosx-10.6-intel-3.6/M2Crypto/SSL
copying M2Crypto/SSL/ssl_dispatcher.py -> build/lib.macosx-10.6-intel-3.6/M2Crypto/SSL
copying M2Crypto/SSL/Checker.py -> build/lib.macosx-10.6-intel-3.6/M2Crypto/SSL
running build_ext
building 'M2Crypto._m2crypto' extension
creating build/temp.macosx-10.6-intel-3.6
creating build/temp.macosx-10.6-intel-3.6/SWIG
/usr/bin/clang -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -I/private/var/folders/cf/dlw4k_s94gx_8d9641fytz5w0000gn/T/pip-install-5bj570na/M2Crypto/SWIG -c SWIG/_m2crypto_wrap.c -o build/temp.macosx-10.6-intel-3.6/SWIG/_m2crypto_wrap.o -DTHREADING -Wno-deprecated-declarations
SWIG/_m2crypto_wrap.c:2887:9: warning: variable 'res' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (PyType_Ready(tp) < 0)
^~~~~~~~~~~~~~~~~~~~
SWIG/_m2crypto_wrap.c:2911:10: note: uninitialized use occurs here
return res;
^~~
SWIG/_m2crypto_wrap.c:2887:5: note: remove the 'if' if its condition is always false
if (PyType_Ready(tp) < 0)
^~~~~~~~~~~~~~~~~~~~~~~~~
SWIG/_m2crypto_wrap.c:2868:10: note: initialize the variable 'res' to silence this warning
int res;
^
= 0
SWIG/_m2crypto_wrap.c:3557:10: fatal error: 'openssl/err.h' file not found
#include <openssl/err.h>
^~~~~~~~~~~~~~~
1 warning and 1 error generated.
error: command '/usr/bin/clang' failed with exit status 1
----------------------------------------
ERROR: Command "/usr/local/bin/python3 -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/cf/dlw4k_s94gx_8d9641fytz5w0000gn/T/pip-install-5bj570na/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 /private/var/folders/cf/dlw4k_s94gx_8d9641fytz5w0000gn/T/pip-record-ereao77x/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/cf/dlw4k_s94gx_8d9641fytz5w0000gn/T/pip-install-5bj570na/M2Crypto/
网友评论