[英]Getting error while using watson_developer_cloud in Jupyter Notebook
我試圖在Jupyter Notebook中使用Watson Developer,但是由於某種原因,我遇到了這樣的錯誤。
This is the import part:
import json
from watson_developer_cloud import AlchemyLanguageV1
之后,我得到這樣的錯誤:
No module named 'watson_developer_cloud'
我使用命令外殼和ANACONDA提示符安裝了Watson Developer雲。 這是我使用的命令,它已成功安裝。
pip install -I watson-developer-cloud==1.0.0
導入Watson Developer時,我是否需要配置任何東西以避免在Jupyter Notebook中發生此錯誤。
這里有一些問題。
1.您可以使用的安裝是:
pip install --upgrade watson-developer-cloud
撰寫本文時,當前版本為2.0.1
,而不是1.0版
2.煉金術不再存在。 您應該改為使用NLU。 SDK中包含示例代碼。
from watson_developer_cloud import NaturalLanguageUnderstandingV1
from watson_developer_cloud.natural_language_understanding_v1 import Features, EntitiesOptions, KeywordsOptions
nlu = NaturalLanguageUnderstandingV1(
version='2017-02-27',
username='USERNAME',
password='PASSWORD')
features = Features(entities=EntitiesOptions(), keywords=KeywordsOptions())
response = nlu.analyze(language='en',
text='The goal is not to be perfect by the end, the goal is to be better today. - Simon Sinek',
features=features)
print(response)
您可以在此處查看SDK示例: https : //github.com/watson-developer-cloud/python-sdk/blob/master/examples
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.