无法在 Mac M1 上安装 M2Crypto

问题描述 投票:0回答:2

我正在尝试使用 python 在 Mac M1 上安装requirements.txt,但我得到了下面的堆栈跟踪。

 Collecting m2crypto
      Using cached https://files.pythonhosted.org/packages/2c/52/c35ec79dd97a8ecf6b2bbd651df528abb47705def774a4a15b99977274e8/M2Crypto-0.38.0.tar.gz
    Requirement already satisfied: typing in /Users/kelvin/.pyenv/versions/2.7.18/lib/python2.7/site-packages (from m2crypto) (3.10.0.0)
    Installing collected packages: m2crypto
      Running setup.py install for m2crypto ... error
        ERROR: Command errored out with exit status 1:
         command: /Users/kelvin/.pyenv/versions/2.7.18/bin/python2.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/yb/wpq8rw3114j3r9l_brykw2_r0000gn/T/pip-install-Vz8dAN/m2crypto/setup.py'"'"'; __file__='"'"'/private/var/folders/yb/wpq8rw3114j3r9l_brykw2_r0000gn/T/pip-install-Vz8dAN/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/yb/wpq8rw3114j3r9l_brykw2_r0000gn/T/pip-record-k7um2g/install-record.txt --single-version-externally-managed --compile
             cwd: /private/var/folders/yb/wpq8rw3114j3r9l_brykw2_r0000gn/T/pip-install-Vz8dAN/m2crypto/
        Complete output (66 lines):
        running install
        running build
        running build_py
        copying src/M2Crypto/callback.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/EVP.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/AuthCookie.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/m2.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/ftpslib.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/EC.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/httpslib.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/X509.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/util.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/RSA.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/BIO.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/DH.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/__init__.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/threading.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/Rand.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/SMIME.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/Engine.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/m2xmlrpclib.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/RC4.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/m2urllib2.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/DSA.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/six.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/m2urllib.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/BN.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/m2crypto.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/Err.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        copying src/M2Crypto/ASN1.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto
        creating build/lib.macosx-12.4-arm64-2.7/M2Crypto/SSL
        copying src/M2Crypto/SSL/cb.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto/SSL
        copying src/M2Crypto/SSL/Session.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto/SSL
        copying src/M2Crypto/SSL/timeout.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto/SSL
        copying src/M2Crypto/SSL/__init__.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto/SSL
        copying src/M2Crypto/SSL/TwistedProtocolWrapper.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto/SSL
        copying src/M2Crypto/SSL/Cipher.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto/SSL
        copying src/M2Crypto/SSL/Connection.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto/SSL
        copying src/M2Crypto/SSL/Context.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto/SSL
        copying src/M2Crypto/SSL/SSLServer.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto/SSL
        copying src/M2Crypto/SSL/ssl_dispatcher.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto/SSL
        copying src/M2Crypto/SSL/Checker.py -> build/lib.macosx-12.4-arm64-2.7/M2Crypto/SSL
        running egg_info
        writing requirements to src/M2Crypto.egg-info/requires.txt
        writing src/M2Crypto.egg-info/PKG-INFO
        writing top-level names to src/M2Crypto.egg-info/top_level.txt
        writing dependency_links to src/M2Crypto.egg-info/dependency_links.txt
        reading manifest file 'src/M2Crypto.egg-info/SOURCES.txt'
        reading manifest template 'MANIFEST.in'
        warning: no files found matching 'SWIG/*.i'
        warning: no files found matching 'SWIG/*.h'
        warning: no files found matching 'SWIG/*.def'
        warning: no files found matching 'SWIG/_m2crypto_wrap.c'
        warning: no files found matching 'M2Crypto/m2crypto.py'
        writing manifest file 'src/M2Crypto.egg-info/SOURCES.txt'
        running build_ext
        building 'M2Crypto._m2crypto' extension
        swigging src/SWIG/_m2crypto.i to src/SWIG/_m2crypto_wrap.c
        swig -python -I/usr/local/include -I/Library/Developer/CommandLineTools/usr/lib/clang/13.1.6/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks (framework directory) -I/usr/local/include -I/Library/Developer/CommandLineTools/usr/lib/clang/13.1.6/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks (framework directory) -I/Users/kelvin/.pyenv/versions/2.7.18/include/python2.7 -I/usr/include/openssl -includeall -modern -builtin -outdir /private/var/folders/yb/wpq8rw3114j3r9l_brykw2_r0000gn/T/pip-install-Vz8dAN/m2crypto/src/M2Crypto -o src/SWIG/_m2crypto_wrap.c src/SWIG/_m2crypto.i
        Deprecated command line option: -modern. This option is now always on.
        src/SWIG/_m2crypto.i:62: Error: Unable to find 'openssl/opensslv.h'
        src/SWIG/_m2crypto.i:68: Error: Unable to find 'openssl/safestack.h'
        src/SWIG/_evp.i:12: Error: Unable to find 'openssl/opensslconf.h'
        src/SWIG/_rc4.i:5: Error: Unable to find 'openssl/opensslconf.h'
        src/SWIG/_ec.i:7: Error: Unable to find 'openssl/opensslconf.h'
        error: command 'swig' failed with exit status 1
        ----------------------------------------
    ERROR: Command errored out with exit status 1: /Users/kelvin/.pyenv/versions/2.7.18/bin/python2.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/yb/wpq8rw3114j3r9l_brykw2_r0000gn/T/pip-install-Vz8dAN/m2crypto/setup.py'"'"'; __file__='"'"'/private/var/folders/yb/wpq8rw3114j3r9l_brykw2_r0000gn/T/pip-install-Vz8dAN/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/yb/wpq8rw3114j3r9l_brykw2_r0000gn/T/pip-record-k7um2g/install-record.txt --single-version-externally-managed --compile Check the logs for full command output
m2crypto
2个回答
3
投票

以防万一您仍然遇到这种情况 - 并且因为这篇文章与我的搜索词匹配 - https://gitlab.com/m2crypto/m2crypto/-/blob/master/INSTALL.rst#macosx 的说明适用于我。万一它消失了,他们就

$ brew install openssl swig
$ LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/include" SWIG_FEATURES="-I$(brew --prefix openssl)/include" pip install m2crypto

0
投票

为了扩展 Mddl 的精彩答案,因为它也适用于 M3,我将标志直接添加到 shell 配置中:

export LDFLAGS="-L$(brew --prefix openssl)/lib"
export CFLAGS="-I$(brew --prefix openssl)/include"
export SWIG_FEATURES="-I$(brew --prefix openssl)/include"
© www.soinside.com 2019 - 2024. All rights reserved.