Ich versuche, das Gesichtserkennungsbeispiel in der Cloud Vision API von Google auszuführen. Ich versuche [faces.py hier] [1] zu rennen.Fehler beim Ausführen des Google Cloud Vision API-Beispiels (Gesichtserkennung)
Wenn ich laufen die folgenden:
faces.py Demo-picture.jpg
unter dem Fehler erhalte ich:
[email protected]:~/Documents/code/python- stuff/googleapis/cloudvisionapi/cloud-vision/python/face_detection$ python faces.py demo-image.jpg
Traceback (most recent call last):
File "faces.py", line 121, in <module>
main(args.input_image, args.output, args.max_results)
File "faces.py", line 98, in main
faces = detect_face(image, max_results)
File "faces.py", line 62, in detect_face
service = get_vision_service()
File "faces.py", line 35, in get_vision_service
credentials = GoogleCredentials.get_application_default()
File "/home/ubuntu/.local/lib/python2.7/site- packages/oauth2client/client.py", line 1398, in get_application_default
return GoogleCredentials._get_implicit_credentials()
File "/home/ubuntu/.local/lib/python2.7/site- packages/oauth2client/client.py", line 1388, in _get_implicit_credentials
raise ApplicationDefaultCredentialsError(ADC_HELP_MSG)
oauth2client.client.ApplicationDefaultCredentialsError: The Application Default Credentials are not available. They are available if running in Google Compute Engine. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining the credentials. See https://developers.google.com/accounts/docs/application- default-credentials for more information.
[email protected]:~/Documents/code/python- stuff/googleapis/cloudvisionapi/cloud-vision/python/face_detection$
[1]: https://github.com/GoogleCloudPlatform/cloud- vision/tree/master/python/face_detection
Ich denke, meine Frage ist - - wie mache ich das:
Andernfalls muss die Umgebungsvariable GOOGLE_APPLICATION_CREDENTIALS definiert werden, die auf eine Datei verweist, die die Anmeldeinformationen definiert.
sollte die Zeile 'export ...' Zeile am Ende der' ~/.bashrc' Datei gehen? – user1406716
Normalerweise gehen alle zusätzlichen/benutzerdefinierten Zeilen, die Sie zu ~/.bashrc hinzufügen, zum Ende. Aber es liegt an dir. –