下面是代碼「類型錯誤:不能實例未知大小的CTYPE 'EVP_MD_CTX'」 而試圖建立谷歌Prediction API進行
import httplib2, argparse, os, sys, json
from oauth2client import tools, file, client
from oauth2client.service_account import ServiceAccountCredentials
from googleapiclient import discovery
from googleapiclient.errors import HttpError
scope = ['https://www.googleapis.com/auth/prediction','https://www.googleapis.com/auth/devstorage.read_only']
def get_api(api, scope, service_account=True):
storage = file.Storage('oAuth2.json')
creds = storage.get()
if creds is None or creds.invalid:
creds = ServiceAccountCredentials.from_json_keyfile_name('service_account.json',
scopes=scope)
storage.put(creds)
http = creds.authorize(httplib2.Http())
return discovery.build(api, 'v1.6', http=http)
api = get_prediction_api('prediction')
下面是在此基礎上blog
錯誤TypeError: cannot instantiate ctype 'EVP_MD_CTX' of unknown size
你有參考嗎? [github頁面](https://github.com/google/google-api-python-client)表示它與Python 3.4完全兼容,並且'此庫可能適用於更高版本的3,但我們目前不運行測試反對這些版本。「我只是感到驚訝,它會在3.4而不是3.5 – User
嗯我有類似的經驗,這個錯誤確實消失了,當我嘗試Python 2.7 – User
其實我現在在Anaconda Python 3.5.2 。不幸的是,我沒有確切的步驟,但我相信它是'pip install pyopenssl'並確保設置了'GOOGLE_APPLICATION_CREDENTIALS' – User