Mac 12.5.1
python 2.7
问题点:在高版本的ox版本上,官方提供的pyelliptic1.5.7版本,使用会有异常。
解析日志时会抛出异常
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都有这个问题
解决方案
下载 https://github.com/mfranciszkiewicz/pyelliptic/archive/1.5.10.tar.gz#egg=pyelliptic 解压,进入目录
修改pyelliptic-1.5.10
编译前的文件,pyelliptic/openssl.py
def find_crypto_lib():
if sys.platform != 'win32':
# 注释掉下面路径,写绝对路径
# return ctypes.util.find_library('crypto')
return '/usr/lib/libcrypto.dylib'
重新运行就不报错了
补充一下,libcrypto.dylib 路径不一定是
/usr/lib/libcrypto.dylib
,可能要在OpenSSL安装目录下找找,比如/usr/local/opt/openssl/lib/libcrypto.dylib
其他异常报错解决方案
ImportError: No module named zstandard
终端执行
pip2 install zstandard --user
Consider using the --user option or check the permissions.
终端执行
pip2 install zstd --user
参考:Exception: Couldn't load OpenSSL lib , 升级到MACOS 11.5.1后出现 #969