安裝 Google Cloud SDK
支持的 Python 版本?Python 3(3.5 到 3.9)。
運(yùn)行?PowerShell 命令:
(New-Object?Net.WebClient).DownloadFile("https://dl.google.com/dl/cloudsdk/channels/rapid/GoogleCloudSDKInstaller.exe", "$env:Temp\GoogleCloudSDKInstaller.exe")& $env:Temp\GoogleCloudSDKInstaller.exe
安裝時(shí),取消選擇”Bundled Python”選項(xiàng)
打開(kāi)Google Cloud SDK Shell
(按照以下步驟輸入) port和address改為自己實(shí)際代理情況
Welcome to the Google Cloud SDK! Run "gcloud -h" to get the list of available commands.
---
D:\Programming\Tools\cloud\google_cloud\cloud_sdk>gcloud config set proxy/type socks5
Updated property [proxy/type].
D:\Programming\Tools\cloud\google_cloud\cloud_sdk>gcloud config set proxy/address 127.0.0.1
Updated property [proxy/address].
D:\Programming\Tools\cloud\google_cloud\cloud_sdk>gcloud config set proxy/port 1080
Updated property [proxy/port].
D:\Programming\Tools\cloud\google_cloud\cloud_sdk>gcloud init
Welcome! This command will take you through the configuration of gcloud.
Settings from your current configuration [proxyconfig0] are:
core:
??disable_usage_reporting: 'False'
proxy:
??address: 127.0.0.1
??port: '1080'
??type: socks5
Pick configuration to use:
?[1] Re-initialize this configuration [proxyconfig0] with new settings
?[2] Create a new configuration
?[3] Switch to and re-initialize existing configuration: [default]
Please enter your numeric choice: ?1
Your current configuration has been set to: [proxyconfig0]
You can skip diagnostics next time by using the following flag:
??gcloud init --skip-diagnostics
Network diagnostic detects and fixes local network connection issues.
Checking network connection...done.
Reachability Check passed.
Network diagnostic passed (1/1 checks passed).
You must log in to continue. Would you like to log in (Y/n)? ?y
Your browser has been opened to visit:
????https://accounts.google.com/o/oauth2/auth?redirect_uri=http%3A%2F%2Flocalhost%3A8085%2F&prompt=select_account&response_type=code&client_id=32555940559.apps.googleusercontent.com&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fappengine.admin+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcompute+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Faccounts.reauth&access_type=offline
You are logged in as: [dreammax1997@gmail.com].
Pick cloud project to use:
?[1] tonal-run-227315
?[2] Create a new project
Please enter numeric choice or text value (must exactly match list
item): ?1
Your current project has been set to: [tonal-run-227315].
Do you want to configure a default Compute Region and Zone? (Y/n)? ?y
Which Google Compute Engine zone would you like to use as project
default?
If you do not specify a zone via a command line flag while working
with Compute Engine resources, the default is assumed.
?[1] us-east1-b
?[2] us-east1-c
?[3] us-east1-d
?[4] us-east4-c
Too many options [56]. Enter "list" at prompt to print choices fully.
Please enter numeric choice or text value (must exactly match list
item): ?1?(根據(jù)實(shí)際情況選)
Your project default Compute Engine zone has been set to [us-east1-b].
You can change it by running [gcloud config set compute/zone NAME].
Your project default Compute Engine region has been set to [us-east1].
You can change it by running [gcloud config set compute/region NAME].
Created a default .boto configuration file at [C:\Users\DreamMax\.boto]. See this file and
[https://cloud.google.com/storage/docs/gsutil/commands/config] for more
information about configuring Google Cloud Storage.
Your Google Cloud SDK is configured and ready to use!
* Commands that require authentication will use dreammax1997@gmail.com by default
* Commands will reference project `tonal-run-227315` by default
* Compute Engine commands will use region `us-east1` by default
* Compute Engine commands will use zone `us-east1-b` by default
要谷歌賬號(hào)綁定信用卡,免費(fèi)試用12個(gè)月,300$贈(zèng)金。
詳細(xì)見(jiàn):Google Cloud_google cloud 永久免費(fèi)_dufufd的博客-CSDN博客
設(shè)置應(yīng)用默認(rèn)憑據(jù)(本地開(kāi)發(fā)環(huán)境)
在Google Cloud SDK shell里運(yùn)行
創(chuàng)建憑據(jù)文件:gcloud auth application-default login
創(chuàng)建服務(wù)帳號(hào)密鑰并將其提供給 ADC
對(duì)于 PowerShell:
$env:GOOGLE_APPLICATION_CREDENTIALS="KEY_PATH"
將 KEY_PATH 替換為包含您的服務(wù)帳號(hào)密鑰的 JSON 文件的路徑。
例如:$env:GOOGLE_APPLICATION_CREDENTIALS="C:\Users\username\Downloads\service-account-file.json"
來(lái)源:https://cloud.google.com/docs/authentication/provide-credentials-adc?hl=zh-cn#local-dev文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-466626.html
配置完應(yīng)用默認(rèn)憑據(jù)后可以使用情感分析,詳細(xì)舉例流程見(jiàn):https://cloud.google.com/natural-language/docs/sentiment-tutorial?hl=zh-cn文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-466626.html
到了這里,關(guān)于Google Cloud Natural Language情感分析教程的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!