我在Google Cloud NL Api上收到了这个错误消息。
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-2-c22ac635f054> in <module>
1 # Imports the Google Cloud client library
----> 2 from google.cloud import language
3 from google.cloud.language import enums
4 from google.cloud.language import types
5
ImportError: cannot import name 'language' from 'google.cloud' (unknown location)我尝试重新安装google cloud language。
这个命令在终端上工作(我得到了一个结果)
gcloud ml language analyze-entities --content="Michelangelo Caravaggio, Italian painter, is known for 'The Calling of Saint Matthew'."我不认为我在使用任何虚拟环境。
我想知道库是否安装在正确的位置,但我不知道如何确定?
发布于 2020-07-12 00:04:00
实际上,这里说你应该在一个虚拟环境中安装这个库:
https://pypi.org/project/google-cloud-language/
(注意:删除所有< >,不需要"“)
pip install virtualenv
virtualenv <your-env>
source <your-env>/bin/activate
<your-env>/bin/pip install google-cloud-language然后,如果你使用的是Jupyter Notebook,你可以按照以下说明进行操作:
https://janakiev.com/blog/jupyter-virtual-envs/
最后,我从一个新的终端窗口重新启动了Jupyter。从菜单中,我选择了kernel / change kernel / "name of your environment“,它成功了!
https://stackoverflow.com/questions/62851087
复制相似问题