python-3.x pip安装m2crypto错误

lrl1mhuk  于 2023-01-03  发布在  Python
关注(0)|答案(6)|浏览(392)
$sudo pip3 install m2crypto
Collecting m2crypto
  Using cached M2Crypto-0.26.0.tar.gz
Requirement already satisfied: typing in /usr/local/lib/python3.5/dist-packages (from m2crypto)
Installing collected packages: m2crypto
  Running setup.py install for m2crypto ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ejd_4lk_/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 /tmp/pip-ecxgdei0-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    copying M2Crypto/BIO.py -> build/lib.linux-x86_64-3.5/M2Crypto
    copying M2Crypto/DH.py -> build/lib.linux-x86_64-3.5/M2Crypto
    copying M2Crypto/Rand.py -> build/lib.linux-x86_64-3.5/M2Crypto
    copying M2Crypto/ftpslib.py -> build/lib.linux-x86_64-3.5/M2Crypto
    copying M2Crypto/m2.py -> build/lib.linux-x86_64-3.5/M2Crypto
    copying M2Crypto/m2xmlrpclib.py -> build/lib.linux-x86_64-3.5/M2Crypto
    copying M2Crypto/callback.py -> build/lib.linux-x86_64-3.5/M2Crypto
    copying M2Crypto/EC.py -> build/lib.linux-x86_64-3.5/M2Crypto
    copying M2Crypto/m2urllib.py -> build/lib.linux-x86_64-3.5/M2Crypto
    copying M2Crypto/X509.py -> build/lib.linux-x86_64-3.5/M2Crypto
    copying M2Crypto/RSA.py -> build/lib.linux-x86_64-3.5/M2Crypto
    copying M2Crypto/ASN1.py -> build/lib.linux-x86_64-3.5/M2Crypto
    copying M2Crypto/m2crypto.py -> build/lib.linux-x86_64-3.5/M2Crypto
    copying M2Crypto/Err.py -> build/lib.linux-x86_64-3.5/M2Crypto
    copying M2Crypto/SMIME.py -> build/lib.linux-x86_64-3.5/M2Crypto
    copying M2Crypto/threading.py -> build/lib.linux-x86_64-3.5/M2Crypto
    copying M2Crypto/m2urllib2.py -> build/lib.linux-x86_64-3.5/M2Crypto
    copying M2Crypto/BN.py -> build/lib.linux-x86_64-3.5/M2Crypto
    copying M2Crypto/RC4.py -> build/lib.linux-x86_64-3.5/M2Crypto
    copying M2Crypto/util.py -> build/lib.linux-x86_64-3.5/M2Crypto
    copying M2Crypto/Engine.py -> build/lib.linux-x86_64-3.5/M2Crypto
    copying M2Crypto/six.py -> build/lib.linux-x86_64-3.5/M2Crypto
    copying M2Crypto/__init__.py -> build/lib.linux-x86_64-3.5/M2Crypto
    copying M2Crypto/EVP.py -> build/lib.linux-x86_64-3.5/M2Crypto
    copying M2Crypto/httpslib.py -> build/lib.linux-x86_64-3.5/M2Crypto
    copying M2Crypto/AuthCookie.py -> build/lib.linux-x86_64-3.5/M2Crypto
    copying M2Crypto/DSA.py -> build/lib.linux-x86_64-3.5/M2Crypto
    creating build/lib.linux-x86_64-3.5/M2Crypto/PGP
    copying M2Crypto/PGP/RSA.py -> build/lib.linux-x86_64-3.5/M2Crypto/PGP
    copying M2Crypto/PGP/PublicKey.py -> build/lib.linux-x86_64-3.5/M2Crypto/PGP
    copying M2Crypto/PGP/PublicKeyRing.py -> build/lib.linux-x86_64-3.5/M2Crypto/PGP
    copying M2Crypto/PGP/constants.py -> build/lib.linux-x86_64-3.5/M2Crypto/PGP
    copying M2Crypto/PGP/packet.py -> build/lib.linux-x86_64-3.5/M2Crypto/PGP
    copying M2Crypto/PGP/__init__.py -> build/lib.linux-x86_64-3.5/M2Crypto/PGP
    creating build/lib.linux-x86_64-3.5/M2Crypto/SSL
    copying M2Crypto/SSL/SSLServer.py -> build/lib.linux-x86_64-3.5/M2Crypto/SSL
    copying M2Crypto/SSL/TwistedProtocolWrapper.py -> build/lib.linux-x86_64-3.5/M2Crypto/SSL
    copying M2Crypto/SSL/ssl_dispatcher.py -> build/lib.linux-x86_64-3.5/M2Crypto/SSL
    copying M2Crypto/SSL/Checker.py -> build/lib.linux-x86_64-3.5/M2Crypto/SSL
    copying M2Crypto/SSL/timeout.py -> build/lib.linux-x86_64-3.5/M2Crypto/SSL
    copying M2Crypto/SSL/Cipher.py -> build/lib.linux-x86_64-3.5/M2Crypto/SSL
    copying M2Crypto/SSL/Connection.py -> build/lib.linux-x86_64-3.5/M2Crypto/SSL
    copying M2Crypto/SSL/Context.py -> build/lib.linux-x86_64-3.5/M2Crypto/SSL
    copying M2Crypto/SSL/cb.py -> build/lib.linux-x86_64-3.5/M2Crypto/SSL
    copying M2Crypto/SSL/__init__.py -> build/lib.linux-x86_64-3.5/M2Crypto/SSL
    copying M2Crypto/SSL/Session.py -> build/lib.linux-x86_64-3.5/M2Crypto/SSL
    running build_ext
    building 'M2Crypto._m2crypto' extension
    swigging SWIG/_m2crypto.i to SWIG/_m2crypto_wrap.c
    swig -python -D__x86_64__ -I/usr/include/python3.5m -I/usr/include -I/usr/include/x86_64-linux-gnu -includeall -modern -builtin -outdir /tmp/pip-build-ejd_4lk_/m2crypto/M2Crypto -o SWIG/_m2crypto_wrap.c SWIG/_m2crypto.i
    /usr/include/x86_64-linux-gnu/sys/cdefs.h:159: Warning 305: Bad constant value (ignored).
    /usr/include/x86_64-linux-gnu/bits/wchar.h:38: Warning 490: Fragment 'SWIG_From_wchar_t' not found.
    /usr/include/stdint.h:274: Warning 490: Fragment 'SWIG_From_wchar_t' not found.
    SWIG/_bio.i:64: Warning 454: Setting a pointer/reference variable may leak memory.
    SWIG/_rand.i:23: Warning 454: Setting a pointer/reference variable may leak memory.
    SWIG/_evp.i:184: Warning 454: Setting a pointer/reference variable may leak memory.
    SWIG/_dh.i:36: Warning 454: Setting a pointer/reference variable may leak memory.
    SWIG/_rsa.i:43: Warning 454: Setting a pointer/reference variable may leak memory.
    SWIG/_dsa.i:31: Warning 454: Setting a pointer/reference variable may leak memory.
    SWIG/_ssl.i:237: Warning 454: Setting a pointer/reference variable may leak memory.
    SWIG/_ssl.i:238: Warning 454: Setting a pointer/reference variable may leak memory.
    SWIG/_x509.i:335: Warning 454: Setting a pointer/reference variable may leak memory.
    SWIG/_pkcs7.i:44: Warning 454: Setting a pointer/reference variable may leak memory.
    SWIG/_pkcs7.i:44: Warning 454: Setting a pointer/reference variable may leak memory.
    SWIG/_util.i:11: Warning 454: Setting a pointer/reference variable may leak memory.
    SWIG/_ec.i:111: Warning 454: Setting a pointer/reference variable may leak memory.
    SWIG/_engine.i:168: Warning 454: Setting a pointer/reference variable may leak memory.
    creating build/temp.linux-x86_64-3.5
    creating build/temp.linux-x86_64-3.5/SWIG
....
At top level:
    SWIG/_m2crypto_wrap.c:3993:13: warning: ‘lock_count’ defined but not used [-Wunused-variable]
     static long lock_count[CRYPTO_NUM_LOCKS];
                 ^~~~~~~~~~
    SWIG/_m2crypto_wrap.c:3992:27: warning: ‘lock_cs’ defined but not used [-Wunused-variable]
     static PyThread_type_lock lock_cs[CRYPTO_NUM_LOCKS];
                               ^~~~~~~
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
**`Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ejd_4lk_/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 /tmp/pip-ecxgdei0-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-ejd_4lk_/m2crypto/`**

安装失败,当我分层安装它时得到:
错误:命令“x86_64-linux-gnu-gcc”失败,退出状态为1

----------------------------------------
**`Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ejd_4lk_/m2crypto/setup.py';f=getattr(tokenize,

“打开”,打开)(文件);代码=f.读取().替换(“\r\n”,“\n”); f.close();exec(compile(code,file,'exec'))”安装--记录/tmp/pip-ecxgdei 0-记录/安装-记录. txt--单一版本-外部管理--编译”失败,错误代码1位于/tmp/pip-build-ejd_4lk_/m2 crypto/'**

〉有人能帮我解决这个问题吗?,谢谢!

hwamh0ep

hwamh0ep1#

我们可以在Python 3上使用m2crypto和以下全局包libssl-dev swig python3-dev gcc
所以

sudo apt-get install libssl-dev swig python3-dev gcc

应允许通过PIP为Python 3安装m2crypto(在版本0.32上测试)

y53ybaqx

y53ybaqx2#

python3.X的MAC步骤:
首次安装。
第一个月
第二次挥动
brew install swig
更改开关功能
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

jyztefdp

jyztefdp3#

M2Crypto(从版本0.26开始)* 不 * 正式支持Python 3。* 正式 * 支持的Python版本有:

Programming Language :: Python :: 2.6
Programming Language :: Python :: 2.7

您遇到的问题与www.example.com中描述的问题相同https://gitlab.com/m2crypto/m2crypto/issues/114#note_13223251
您可以在http://py3readiness.org/中找到哪些流行的库与Python 3兼容

vwhgwdsa

vwhgwdsa4#

我在python 2.7上遇到了这个错误。
当python的c依赖项不可用,而pip试图安装和编译一个有c扩展名的包时,就会发生这种情况。

sudo apt-get install python-dev

这为我解决了这个问题。
安装M2Crypto

pip install m2crypto
qco9c6ql

qco9c6ql5#

好了,这个100%有效

apt install python2.7
python2.7 -m pip install M2Crypto
uqjltbpv

uqjltbpv6#

对于Windows和Python 3.7、3.8、3.9或3.10,请参见this链接

相关问题