Google Cloud AutoML 有用于检测的 python 示例代码,但导入这些模块时出现错误
from google.cloud import automl_v1beta1
from google.cloud.automl_v1beta1.proto import service_pb2
它说
cannot import name automl_v1beta1
.我知道这是一个常见问题,互联网上有很多解决方案,但到目前为止没有任何效果。我正在使用 Windows 10 并在 Anaconda 环境中运行 python 2.7。我尝试了这些,但没有任何效果:
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
最佳答案
我刚刚解决了它,这是一个非常简单的问题。我重新安装google-cloud-automl
使用下面的命令和作品。
pip.exe install google-cloud-automl
为什么我上次尝试它不起作用?这是因为我没有以 运行 anaconda 提示符。管理员 .原因是安装时
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 才会成功删除。上次它抛出了我没有意识到的身份验证错误,所以重新安装过程停止了。希望它对 future 的一些人有所帮助。
关于python - 如何使用 anaconda 为 python 安装 google.cloud automl_v1beta1?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55606725/