我希望使用 Python 中的 Twilio CLI 运行以下命令:
ngrok_cmd = "twilio phone-numbers:update "+ my_number " --sms url=https://localhost:5000"
os.system(ngrok_cmd)
该命令适用于终端,但如果我尝试通过 python 执行它则不会。它不断给出以下错误:
sh: 1: twilio: not found
编辑:
我试过这个:
ngrok_cmd = "/home/pi/.config/nvm/versions/node/v16.13.1/bin/twilio phone-numbers:update "+ my_number " --sms url=http://localhost:5000"
os.system(ngrok_cmd)
现在我得到这个错误:
» Could not find profile.
» To create the profile, run:
twilio profiles:create
Alternatively, twilio-cli can use credentials stored in environment variables:
# OPTION 1 (recommended)
export TWILIO_ACCOUNT_SID=your Account SID from twil.io/console
export TWILIO_API_KEY=an API Key created at twil.io/get-api-key
export TWILIO_API_SECRET=the secret for the API Key
# OPTION 2
export TWILIO_ACCOUNT_SID=your Account SID from twil.io/console
export TWILIO_AUTH_TOKEN=your Auth Token from twil.io/console
Once these environment variables are set, a twilio-cli profile is not required and you may skip the "login" step.
但是,我已经在 /etc/profile 中设置了环境变量并通过以下方式进行了验证:
printenv | grep TWI
我不知道这个错误的原因是什么。谁能帮我这个?