2015-12-07 68 views
0

我嘗試安裝M2Crypto但sudo pip install M2Crypto是給下面的錯誤:無法導入M2Crypro爲Mac OS X 10.10.5

850 warnings and 3 errors generated. 
    error: command 'cc' failed with exit status 1 

    ---------------------------------------- 
    Rolling back uninstall of M2Crypto 
Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-uSFYDz/M2Crypto/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-Nsz5C6-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-build-uSFYDz/M2Crypto 

然後我安裝sudo pip install M2Crypto==0.21.1。它沒有給出任何錯誤,但當我試圖導入以下錯誤即將到來:

>>> import M2Crypto 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
    File "/Library/Python/2.7/site-packages/M2Crypto/__init__.py", line 24, in <module> 
    import ASN1 
    File "/Library/Python/2.7/site-packages/M2Crypto/ASN1.py", line 12, in <module> 
    import BIO 
    File "/Library/Python/2.7/site-packages/M2Crypto/BIO.py", line 221, in <module> 
    class CipherStream(BIO): 
    File "/Library/Python/2.7/site-packages/M2Crypto/BIO.py", line 227, in CipherStream 
    SALT_LEN = m2.PKCS5_SALT_LEN 
AttributeError: 'module' object has no attribute 'PKCS5_SALT_LEN' 

任何幫助讚賞!

回答

1

INSTALL說,在Mac電腦上安裝:

Apple does not provide on more recent versions of Mac OS X (at least certainly since 10.11) any version of OpenSSL, so it is necessary to use brew or similar packaging systems to install third party packages. A Mac OS X users suggested, that this series of commands gave him a working copy of M2Crypto on his system: $ brew install openssl && brew install swig $ brew --prefix openssl /usr/local/opt/openssl $ LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/include" \ SWIG_FEATURES="-I$(brew --prefix openssl)/include" \ pip install m2crypto

恐怕完全AUTOMAGIC pip安裝不起作用 ATM。任何合併請求都可以找到現有的OpenSSL安裝,其中 將在Mac上進行測試。

+0

@ david-fang請問你能接受我的回答嗎?謝謝。 – mcepl