Python 基础 - 备忘

运行 Python 代码

python filename.py

注意一定要带 python ,Linux 环境下可能是 python3

更换 PIP 源

pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/

更新 PIP

python -m pip install --upgrade pip

安装 pytest

python -m pip install --user pytest

运行 pytest

在 Terminal 中输入 pytest

如果在执行命令 pytest 时没有制定任何参数,pytest 将运行它在当前目录中找到的所有测试。要测试指定文件,使用 pytest test_filename.py

安装 pygame

python -m pip install --user pygame

在pygame 界面中,如果要检测按键,需确保输入法为英文,否则即使程序正确也会出现按键无效的现象。

相关推荐
无限的鲜花7 小时前
反射(原创推荐)
java·开发语言
hhzz7 小时前
基于监控视频的水位尺自动识别技术方案与实现
python·opencv·yolo·图像识别·cv
yongche_shi7 小时前
ragas官方文档中文版(五十)
开发语言·python·ai·ragas·如何评估和改进 rag 应用
一路向北he7 小时前
字节钢铁军团--“提供情境,而非控制”
java·开发语言·前端
weixin_408099678 小时前
OCR批量识别图片方案:从手动处理到自动化API系统(Python/Java/PHP实战)
图像处理·python·ocr·文字识别·api调用·批量识别·石榴智能
AI行业学习9 小时前
Notepad++ 官方下载 + 完整安装 + 全套优化配置(2026最新)
开发语言·人工智能·python·前端框架·html·notepad++
大圣编程9 小时前
Python中continue语句的用法是什么?
开发语言·前端·python
云烟成雨TD10 小时前
LangFlow 1.x 系列【5】可视化编辑页面功能说明
人工智能·python·agent
upgrador10 小时前
基础知识:C++ STL构造函数的左闭右开惯例及其实现原理
开发语言·c++
yoothey11 小时前
报废审批流规则引擎设计——责任链模式完整实现
linux·开发语言·bash