会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
chenzhi2023
博客园
首页
新随笔
联系
订阅
管理
2025年9月8日
82python解析器反查当前安装了那些依赖包
摘要: # 不带版本号 python -c "import pkg_resources, sys; [print(d.project_name) for d in pkg_resources.working_set]" # 带版本号 python -c "import pkg_resources, sys,
阅读全文
posted @ 2025-09-08 20:26 冷夜O
阅读(10)
评论(0)
推荐(0)
2025年8月1日
82观察者设计模式
摘要: # 主题(被观察者)接口 class Subject: def register_observer(self, observer): pass def remove_observer(self, observer): pass def notify_observers(self): pass # 观
阅读全文
posted @ 2025-08-01 19:50 冷夜O
阅读(3)
评论(0)
推荐(0)
2025年7月30日
01docker源更改加速下载
摘要: linux下docker配置路径 /etc/docker/daemon.json 替换为 { "runtimes": { "nvidia": { "args": [], "path": "nvidia-container-runtime" } }, "registry-mirrors": [ "ht
阅读全文
posted @ 2025-07-30 11:36 冷夜O
阅读(14)
评论(0)
推荐(0)
2025年7月29日
81解决安装依赖强制安装或重装
摘要: pip install "numpy<2,>=1.21" --force-reinstall--force-reinstall 告诉 pip:无论目标包是否已经安装,都把“它”和“它依赖的所有包”全部重新下载、重新安装一遍,覆盖现有文件
阅读全文
posted @ 2025-07-29 17:10 冷夜O
阅读(40)
评论(0)
推荐(0)
2025年7月7日
80命令行应用程序开发
摘要: import click @click.command() @click.option("--text",default="hello",help="the text to print") def fun1(text): """Run the main program.""" print(text)
阅读全文
posted @ 2025-07-07 18:05 冷夜O
阅读(6)
评论(0)
推荐(0)
2025年2月21日
78websoeket集成到flask框架
摘要: # server端from flask import Flask from flask_socketio import SocketIO app = Flask(__name__) app.config["SECRET_KEY"] ="gsagdgasg436fgsdh" socketio = So
阅读全文
posted @ 2025-02-21 20:32 冷夜O
阅读(17)
评论(0)
推荐(0)
2025年1月21日
77命令行解析getopt库
摘要: import getopt import sys r""" getopt.getopt(sys.argv[1:], "hf:", ["help", "file="]) sys.argv[1:]:这是要解析的命令行参数列表。sys.argv 是一个包含命令行参数的列表,其中 sys.argv[0] 是
阅读全文
posted @ 2025-01-21 17:34 冷夜O
阅读(7)
评论(0)
推荐(0)
2025年1月10日
75flask 框架使用 uwsgi 服务器
摘要: 1.flask框架应用模块跟uswgi 配置放在同一个目录 [root@localhost test_uwsgi]# ls app.py instance log __pycache__ uwsgi.ini 2.配置uwsgi文件 [uwsgi] #uwsgi启动时,所使用的地址和端口(这个是htt
阅读全文
posted @ 2025-01-10 16:59 冷夜O
阅读(9)
评论(0)
推荐(0)
2024年10月28日
67实现数学除法商进一法
摘要: import math # 实现数学除法商进一法 dividend = 153 divisor = 100 result = dividend / divisor # 结果1.53 # math.ceil 函数向上取整 rounded_result = math.ceil(result) # 结果2
阅读全文
posted @ 2024-10-28 10:17 冷夜O
阅读(29)
评论(0)
推荐(0)
2024年10月25日
66openpyxl的遍历读写操作(常用于数据批量读出来和写进去)
摘要: import openpyxl from openpyxl import Workbook # 常用于数据批量读出来和写进去 # 往表格写入操作 def create_wb(): # 创建一个新的工作簿 wb = Workbook() # 选择默认的工作表 ws = wb.active # 假设这是
阅读全文
posted @ 2024-10-25 16:20 冷夜O
阅读(225)
评论(0)
推荐(0)
下一页
公告