简体   繁体   English

如何使用 anaconda 为 python 安装 google.cloud automl_v1beta1?

[英]How to install google.cloud automl_v1beta1 for python using anaconda?

Google Cloud AutoML has python example code for detection, but I have error when importing these modules Google Cloud AutoML 有用于检测的 python 示例代码,但我在导入这些模块时出错

from google.cloud import automl_v1beta1
from google.cloud.automl_v1beta1.proto import service_pb2

It says cannot import name automl_v1beta1 .它说cannot import name automl_v1beta1 I know it's a common problem and there are many solutions on internet but nothing has worked so far.我知道这是一个常见问题,互联网上有很多解决方案,但到目前为止没有任何效果。 I'm using Windows 10 and run python 2.7 on Anaconda environment.我正在使用 Windows 10 并在 Anaconda 环境中运行 python 2.7。

I tried these, but nothing worked :我尝试了这些,但没有任何效果:

conda install -c conda-forge google-cloud-sdk
conda install -c conda-forge google-cloud-storage 
python -m pip install google-cloud
pip install google-cloud-automl

I just solved it and it's a very simple problem.我刚刚解决了它,这是一个非常简单的问题。 I reinstall google-cloud-automl using below command and works.我使用以下命令重新安装google-cloud-automl并工作。

pip.exe install google-cloud-automl

Why it didn't work last time I tried it?为什么我上次尝试没有用? It's because I didn't run anaconda prompt as administrator .这是因为我没有以管理员身份运行 anaconda prompt 。 The reason is when installing google-cloud-automl it will uninstall deprecated projects like future , like this :原因是在安装google-cloud-automl它会卸载不推荐使用的项目,例如future ,如下所示:

Found existing installation: futures 3.1.1
    DEPRECATION: Uninstalling a distutils installed project (futures) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
    Uninstalling futures-3.1.1:
      Successfully uninstalled futures-3.1.1

Future will be only successfully removed if I run the command as administrator.如果我以管理员身份运行命令,Future 只会被成功删除。 Last time it thrown authentication error that I didn't realize, so the re-installation process stopped.上次它抛出了我没有意识到的身份验证错误,因此重新安装过程停止了。 Hope it will help some people in the future.希望它会在未来帮助一些人。

You can install packages inside the Jupiter notebook cell, I hope it will work for you.您可以在 Jupiter 笔记本单元内安装软件包,我希望它对您有用。 在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM