如何解决" CryptoUnavailableError:没有可用的加密库"在OS X上的Conda?

时间:2016-01-03 14:05:18

标签: python python-3.x google-oauth anaconda conda

我尝试使用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虚拟环境中,我成功安装了以下库:

  • pip install google-api-python-client --upgrade
  • conda install cryptography
  • conda install pyopenssl

但是,以下代码片段仍会导致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版本:10.10.5
  • conda version:3.18.9
  • jupyter版本:4.0.6
  • Python版本:3.5.1

任何人都设法在OS X上的Conda中为Python 3.5加密?

0 个答案:

没有答案