Mac 12.5.1
python 2.7
問題點(diǎn):在高版本的ox版本上卖怜,官方提供的pyelliptic1.5.7版本,使用會(huì)有異常。
解析日志時(shí)會(huì)拋出異常
Traceback (most recent call last):
File "/Users/maoqis/Documents/work/logs/bin/decode_mars_crypt_log_file.py", line 9, in
import pyelliptic
File "build/bdist.macosx-10.9-x86_64/egg/pyelliptic/init.py", line 43, in
File "build/bdist.macosx-10.9-x86_64/egg/pyelliptic/openssl.py", line 637, in
Exception: Couldn't load OpenSSL lib ...
理論上python2和python3都有這個(gè)問題
解決方案
下載 https://github.com/mfranciszkiewicz/pyelliptic/archive/1.5.10.tar.gz#egg=pyelliptic 解壓,進(jìn)入目錄
修改pyelliptic-1.5.10
編譯前的文件,pyelliptic/openssl.py
def find_crypto_lib():
if sys.platform != 'win32':
# 注釋掉下面路徑,寫絕對(duì)路徑
# return ctypes.util.find_library('crypto')
return '/usr/lib/libcrypto.dylib'
重新運(yùn)行就不報(bào)錯(cuò)了
補(bǔ)充一下,libcrypto.dylib 路徑不一定是
/usr/lib/libcrypto.dylib
彻秆,可能要在OpenSSL安裝目錄下找找,比如/usr/local/opt/openssl/lib/libcrypto.dylib
其他異常報(bào)錯(cuò)解決方案
ImportError: No module named zstandard
終端執(zhí)行
pip2 install zstandard --user
Consider using the --user option or check the permissions.
終端執(zhí)行
pip2 install zstd --user
參考:Exception: Couldn't load OpenSSL lib , 升級(jí)到MACOS 11.5.1后出現(xiàn) #969