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 界面中,如果要检测按键,需确保输入法为英文,否则即使程序正确也会出现按键无效的现象。

相关推荐
Norna1 小时前
Git 给路径加了引号,这个文件就从 review 里消失了
python
wuyk5551 小时前
Python办公自动化-第04讲-批量新建Excel
开发语言·python·excel
wuyk5551 小时前
Spider-第20讲-综合实战可上线爬虫
大数据·爬虫·python·elasticsearch
code2cat2 小时前
【随笔】Java客户端选了HTTP/3,怎样知道请求实际走了哪个版本
java·开发语言·http
JonaHu2 小时前
关键词排名突然消失?用 Python、SQLite 和 SERP API 搭一套可解释的 SEO 监控
python·sqlite·seo·serp api
prince_zxill3 小时前
把 17 个散文件装进一个文件夹:拆解 claude-plugins-official 的插件打包术(47,413 Star 实测)
python·github·agent·mcp·claude code
少司府3 小时前
嵌入式外设篇(三)GPIO·三:MCU系统结构、总线与统一编制
linux·python·stm32·单片机·嵌入式硬件·mcu·嵌入式软件
伞伞悦读4 小时前
【第90期】KNN分类回归流水线与K值对照的实验与排查
大数据·人工智能·python·深度学习·机器学习
console.log('npc')5 小时前
Python 学习教程 · 第4课:数据结构
数据结构·python·学习
honker_X5 小时前
Python字符串全攻略:从入门到精通
开发语言·python