我已经在谷歌应用引擎中运行了一个python应用程序超过一年。我试图使用情绪分析。
from google.cloud import language
我收到此错误:
from google.cloud import language ImportError: cannot import name language.
可能与此类似:from google.cloud import language ImportError: No module named cloud
谷歌模块似乎发生了变化。我的代码中也有这些:
from google.appengine.api import urlfetch
from google.appengine.api import taskqueue
from google.appengine.ext import ndb
from google.appengine.ext import deferred
谢谢,
我正在深入研究这个问题。当我更新google cloud sdk时,我想我的安装搞砸了。
看起来我有两个谷歌模块的位置:
C:\Users\username\lib\google
C:\Python27\Lib\site-packages\google\cloud\language
以下是有关使用gcloud信息进行配置的更多信息。
Python Location: [C:\Users\username\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\bundledpython\python.exe]
Site Packages: [Disabled]
System PATH: [C:\Users\username\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin\..\bin\sdk;C:\Users\username\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin;C:\Program Files (x86)\Google\Chrome\Application;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Sennheiser\SoftphoneSDK\;C:\Program Files (x86)\WebEx\Productivity Tools;C:\Python27\;C:\Python27\Scripts;C:\Users\username\scoop\apps\python\current\scripts;C:\Users\username\AppData\Local\Programs\Python\Launcher\;C:\Users\username\scoop\shims;C:\Users\username\AppData\Local\Microsoft\WindowsApps;C:\Users\username\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin;]
Python PATH: [C:\Users\username\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin\..\lib\third_party;C:\Users\username\AppData\Local\Google\Cloud SDK\google-cloud-sdk\lib;C:\Users\username\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\bundledpython\python27.zip;C:\Users\username\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\bundledpython\DLLs;C:\Users\username\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\bundledpython\lib;C:\Users\username\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\bundledpython\lib\plat-win;C:\Users\username\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\bundledpython\lib\lib-tk;C:\Users\username\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\bundledpython]
Cloud SDK on PATH: [True]
答案 0 :(得分:0)
最终我从我的项目目录中做到了这一点:
pip install -t lib/ --upgrade google-api-python-client
pip install -t lib/ --upgrade google-cloud