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

相关推荐
这里有鱼汤3 分钟前
“对象”?对象你个头!——Python世界观彻底崩塌的一天
后端·python
尘浮72812 分钟前
60天python训练计划----day59
开发语言·python
wh393315 分钟前
使用Python将PDF转换成word、PPT
python·pdf·word
船长@Quant32 分钟前
数学视频动画引擎Python库 -- Manim Voiceover 语音服务 Speech Services
python·数学·manim·动画引擎·语音旁白
Chef_Chen41 分钟前
从0开始学习R语言--Day39--Spearman 秩相关
开发语言·学习·r语言
不学会Ⅳ1 小时前
Mac M芯片搭建jdk源码环境(jdk24)
java·开发语言·macos
好开心啊没烦恼2 小时前
Python 数据分析:计算,分组统计1,df.groupby()。听故事学知识点怎么这么容易?
开发语言·python·数据挖掘·数据分析·pandas
lljss20203 小时前
Python11中创建虚拟环境、安装 TensorFlow
开发语言·python·tensorflow
空中湖3 小时前
tensorflow武林志第二卷第九章:玄功九转
人工智能·python·tensorflow
CodeCraft Studio4 小时前
CAD文件处理控件Aspose.CAD教程:使用 Python 将绘图转换为 Photoshop
python·photoshop·cad·aspose·aspose.cad