简体   繁体   English

如何使用Python pip安装google.cloud?

[英]How to install google.cloud with Python pip?

I am relatively new to Python and I am stuck on something which is probably relatively easy to resolve. 我对Python还是比较陌生,因此我只能解决一些相对容易解决的问题。

I have installed the following packages: 我已经安装了以下软件包:

pip install --upgrade google-api-python-client
pip install --upgrade google-cloud
pip install --upgrade google-cloud-vision

In my Python file I have: 在我的Python文件中,我有:

import cv2
import io
import os

# Imports the Google Cloud client library
from google.cloud import vision

...etc...

And this gives me the error: 这给了我错误:

Traceback (most recent call last):
  File "test.py", line 6, in <module>
    from google.cloud import vision
ImportError: No module named 'google.cloud'

What am I missing and where should I look (logs?) to find the answer in the future. 我缺少什么,将来应该在哪里寻找(日志?)以找到答案。

PS: PS:
Pip installs of google-cloud and google-cloud-vision have the output: google-cloudgoogle-cloud-vision Pip安装具有以下输出:

Cannot remove entries from nonexistent file /Users/foobar/anaconda/lib/python3.5/site-packages/easy-install.pth

UPDATE : 更新
Running pip freeze doesn't show the packages to be installed... 运行pip freeze不会显示要安装的软件包...

I had a similar problem. 我有一个类似的问题。 Adding "--ignore-installed" to my pip command made it work for me. 在我的pip命令中添加“ --ignore-installed”使其对我有用。

This might be a bug in pip - see this page for more details: https://github.com/pypa/pip/issues/2751 这可能是pip中的错误-有关更多详细信息,请参见此页面: https : //github.com/pypa/pip/issues/2751

You need to download and install the google-cloud-sdk. 您需要下载并安装google-cloud-sdk。 Follow this link https://cloud.google.com/sdk/docs/ 点击此链接https://cloud.google.com/sdk/docs/

尝试这个 :

from google.cloud.vision import *

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

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