一行显示要运行以下内容:
Run: python -m data_preparation.data_prep to generate training/validation/testing data as well as to generate constants needed for normalization. The produced data has the following columns:
但是,我不断收到以下错误。关于我在做什么错的任何想法。
这是错误:
Abrahams-MBP:energy_forecasting abrahammathew$ python -m data_preparation.data_prep
Traceback (most recent call last):
File "/Users/abrahammathew/anaconda3/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/Users/abrahammathew/anaconda3/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/Users/abrahammathew/Desktop/energy_forecasting/data_preparation/data_prep.py", line 323, in <module>
main()
File "/Users/abrahammathew/Desktop/energy_forecasting/data_preparation/data_prep.py", line 317, in main
client = bigquery.Client()
File "/Users/abrahammathew/anaconda3/lib/python3.6/site-packages/google/cloud/bigquery/client.py", line 124, in __init__
project=project, credentials=credentials, _http=_http)
File "/Users/abrahammathew/anaconda3/lib/python3.6/site-packages/google/cloud/client.py", line 215, in __init__
_ClientProjectMixin.__init__(self, project=project)
File "/Users/abrahammathew/anaconda3/lib/python3.6/site-packages/google/cloud/client.py", line 169, in __init__
project = self._determine_default(project)
File "/Users/abrahammathew/anaconda3/lib/python3.6/site-packages/google/cloud/client.py", line 182, in _determine_default
return _determine_default_project(project)
File "/Users/abrahammathew/anaconda3/lib/python3.6/site-packages/google/cloud/_helpers.py", line 179, in _determine_default_project
_, project = google.auth.default()
File "/Users/abrahammathew/anaconda3/lib/python3.6/site-packages/google/auth/_default.py", line 306, in default
raise exceptions.DefaultCredentialsError(_HELP_MESSAGE)
google.auth.exceptions.DefaultCredentialsError: Could not automatically determine credentials. Please set GOOGLE_APPLICATION_CREDENTIALS or explicitly create credentials and re-run the application. For more information, please see https://developers.google.com/accounts/docs/application-default-credentials.
答案 0 :(得分:2)
我认为您必须先配置GCP帐户的凭据。在命令行set environment variable的同一会话中:
'
您可以在本地/计算机环境变量选项卡的所有命令行会话中将其设置在计算机上(类似于设置%PATH%的位置)。
有关如何使用您的凭据获取JSON文件的详细信息,请参见the URL that the exception points to。