gpt4 book ai didi

python - 使用 flask 询问和 ngrok 错误的 Alexa 技能开发

转载 作者:行者123 更新时间:2023-12-03 19:07:03 25 4
gpt4 key购买 nike

我正在尝试使用 python 中的 flask-ask 和 ngrok 开始为 Alexa 开发一项技能。以下是我的代码:

from flask import Flask

from flask_ask import Ask, statement


app = Flask(__name__)
ask = Ask(app, "/")

@ask.launch
def start_skill():
welcome_message = 'Hello there'
return statement(welcome_message)

@ask.intent("sampleIntent")
def sampleIntent():
return statement('I am the sample intent')

@app.route('/')
def homepage():
return "Hi,there"


if __name__ == '__main__':

app.run(port=7025, debug=True)
代码在我的机器上运行良好,如果我打印出来,则返回正确的输出,并且当我查看 ngrok https 链接和 python localhost 链接时,我能够查看文本“嗨,那里”。 ngrok 和 python 代码都在 7025 的同一个端口上。
我知道问题是密码学,因为我安装了 3.0 版。教程指示我降级密码学和 Werkzeug。我能够降级 Werkzeug,但无法降级密码学。 pip 卡住如下:
aniso8601==1.2.0
appdirs==1.4.4
ask-sdk-core==1.14.0
ask-sdk-model==1.24.0
ask-sdk-runtime==1.14.0
ask-sdk-webservice-support==1.2.0
asn1crypto==1.4.0
certifi==2020.6.20
cffi==1.14.1
chardet==3.0.4
click==7.1.2
cryptography==3.0
distlib==0.3.1
filelock==3.0.12
Flask==0.12.1
Flask-Ask==0.9.8
flask-ask-sdk==1.0.0
idna==2.10
itsdangerous==1.1.0
Jinja2==2.11.2
MarkupSafe==1.1.1
openssl-python==0.1.1
pycparser==2.20
pyOpenSSL==17.0.0
pyserial==2.7
python-dateutil==2.8.1
PyYAML==3.12
requests==2.24.0
six==1.11.0
Unidecode==1.1.1
urllib3==1.25.10
virtualenv==20.0.30
Werkzeug==0.16.0
当我尝试将密码学降级到 2.1.4 版本时,我得到了很多红色文本,但是,第一行似乎是:
   Running setup.py install for cryptography ... error
我正在运行 python 版本 3.8.5,我有 pip 版本 20.2.2。

最佳答案

有几种方法可以解决这个问题,在我看来,最简单的方法如下(需要 git):

  • 导航到项目的根文件夹
  • 克隆 flask 询问仓库:git clone https://github.com/johnwheeler/flask-ask -- 这将在您的项目目录
  • 中创建该 repo 的本地副本
  • 修改/your_project/flask_ask/中的 requirements.txt 文件并从加密包中删除版本号。它目前被卡住在 ==2.1.4 -- 只需删除 ==2.1.4允许 pip 解析正确的依赖项。
  • 一旦你修改了底层包,仍然在/your_project/flask_ask/运行 pip install -e . -- 这将安装flask_ask 包的“可编辑”副本,以便识别进一步的更新

  • enter image description here

    关于python - 使用 flask 询问和 ngrok 错误的 Alexa 技能开发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63361235/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com