我尝试使用OAUTH2服务帐户从运行Python 3.5内核的IPython访问Google App电子表格,利用Google API Python客户端,但却遇到了" CryptoUnavailableError:No crypto library available& #34;错误。
我关注了Google的文档(https://developers.google.com/api-client-library/python/auth/service-accounts),并在堆栈溢出上查阅了各种文章。在conda虚拟环境中,我成功安装了以下库:
但是,以下代码片段仍会导致CryptoUnavailableError:
from oauth2client.client import SignedJwtAssertionCredentials
with open("mykey.p12", 'rb') as f:
private_key = f.read()
client_email = 'myaccount@myapplication.iam.gserviceaccount.com'
scope = 'https://spreadsheets.google.com/feeds'
credentials = SignedJwtAssertionCredentials(client_email, private_key, scope)
任何人都设法在OS X上的Conda中为Python 3.5加密?