我在Flask中收到“ TypeError: init ()得到了意外的关键字参数'iam_api_key'”的错误。实际上,在安装Flask之前,它在Python 2.7和3上运行良好。但是,现在在Flask安装之后,它就无法在Python 3中使用。但是,仍然可以使用Python 2。
from flask import Flask
from os.path import join, dirname
import json
app = Flask(__name__)
from watson_developer_cloud import SpeechToTextV1
@app.route('/',['GET'])
def hello_world():
url="https://gateway-wdc.watsonplatform.net/speech-to-text/api"
iam_api_key="IkhuCl3jbYWRJ3QV623PzX6e8715iCV6mbPA7evrD3qYHyS"
speech_to_text = SpeechToTextV1(url=url,iam_api_key=iam_api_key)
print (speech_to_text)
return 'Hello, World!'
if __name__ == '__main__':
app.run(debug = True)