随笔分类 -  dev_python

摘要:当使用Python Gradio框架构建聊天网页程序的时候,我用的是gr.Block来定义组件,但是遇到一个问题就是没法获取request对象,导致我bot机器人回复消息的时候拿不到用户的session身份信息。查阅了官方文档,没有找到合适的,最后在github讨论区发现了类似的方法。https:/ 阅读全文
posted @ 2025-04-24 10:36 saaspeter 阅读(95) 评论(0) 推荐(0)
摘要:python 的asyncio的相关文章:https://realpython.com/async-io-python/#the-event-loop-and-asynciorun https://glyph.twistedmatrix.com/2014/02/unyielding.html 阅读全文
posted @ 2024-12-02 23:29 saaspeter 阅读(27) 评论(0) 推荐(0)
摘要:运行openai相关api的时候,需要用到代理。 key就在环境变量中建立:OPENAI_API_KEY 和 OPENAI_PROXY 在pycharm中如果想让整个python运行的时候都走代理,可以设置Environment Variables:http_proxy=http://127.0.0 阅读全文
posted @ 2024-11-27 20:52 saaspeter 阅读(38) 评论(0) 推荐(0)
摘要:install packages in a virtual environment using pip and venv https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environmen 阅读全文
posted @ 2024-07-18 14:32 saaspeter 阅读(26) 评论(0) 推荐(0)
摘要:pip安装出错: error: externally-managed-environment × This environment is externally managed ╰─> To install Python packages system-wide, try apt install py 阅读全文
posted @ 2024-07-13 17:04 saaspeter 阅读(804) 评论(0) 推荐(0)
摘要:以下文章非常好的解释了python中的async wait的用法。copy自:https://fastapi.tiangolo.com/async/#in-a-hurry Details about the async def syntax for path operation functions  阅读全文
posted @ 2023-08-03 21:12 saaspeter 阅读(43) 评论(0) 推荐(0)
摘要:我在terminal中设置了proxy后,开启proxyon后,执行npm install包错误: (proxyon是通过在~/.zshrc 中添加export http_proxy来实现的) 把proxyoff后,错误又没有了,不知道是啥问题。如果碰到这个问题就用: npm config set 阅读全文
posted @ 2023-05-30 12:34 saaspeter 阅读(2975) 评论(0) 推荐(0)
摘要:在pycharm的Edit configuration中:“save console output to file”. see also: https://www.jetbrains.com/help/idea/setting-log-options.html?_ga=2.133841998.196 阅读全文
posted @ 2023-04-22 11:14 saaspeter 阅读(4501) 评论(0) 推荐(0)
摘要:https://docs.scrapy.org/en/latest/intro/tutorial.html https://docs.scrapy.org/en/latest/topics/selectors.html https://docs.scrapy.org/en/latest/topics 阅读全文
posted @ 2023-03-28 19:01 saaspeter 阅读(27) 评论(0) 推荐(0)
摘要:本文的重点介绍python中的yield用法及这样的表达式: comp_list = [x * 2 for x in range(10)] -- List Comprehensions 和 (x ** 2 for x in range(10)) -- Generator Expressions 摘抄 阅读全文
posted @ 2023-03-28 14:49 saaspeter 阅读(36) 评论(0) 推荐(0)