logo
0
0
Login

python学习指南

python是目前使用最广泛的脚本语言,在科学计算,数据分析,AI,自动化运维,网络编程,系统运维等多个领域都有着广泛的应用。Python的语法并不复杂,即使不理解语法,也能快速上手实现。本系列主要包含Python语法了解,Python工具运用,PyQt开发调试等的综合项目,主要用于Python积累学习。

install

python的下载地址: https://www.python.org/ftp/python/3.13.0/

#安装python3和pip3 sudo apt-get install python3 pip3 #支持media的库 sudo apt-get install python-pyqt5.qtmultimedia sudo apt-get install libqt5multimedia5-plugins sudo apt-get install gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav #使用清华源安装python库 pip3 install [module] -i https://pypi.tuna.tsinghua.edu.cn/simple/

常用模块安装命令如下。

#安装pyQT5环境 pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyQt5 #python设置长期安装源(windows下可能因为权限问题不成功) pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple #常用库安装 #将ui转换成python的库 pip3 install uic -i https://pypi.tuna.tsinghua.edu.cn/simple pyuic5 file.ui > file.py #安装numpy pip3 install numpy -i https://pypi.tuna.tsinghua.edu.cn/simple #安装pyQT相关库 pip3 install pyqt5-tools PyQt5 -i https://pypi.tuna.tsinghua.edu.cn/simple #安装QtChart相关库,图标显示 pip3 install PyQtChart -i https://pypi.tuna.tsinghua.edu.cn/simple pip3 install PyQtWebEngine -i https://pypi.tuna.tsinghua.edu.cn/simple #安装音频解码相关的库 sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1.0-pulseaudio #打包系统,生成 pip3 install PyInstaller -i https://pypi.tuna.tsinghua.edu.cn/simple PyInstaller -F -w file.py -F 打包成exe文件 -D 创建一个目录,包含EXE文件 -c 使用控制台,无窗口 -w 使用窗口,无控制台 #安装获取网络信息 pip3 install netifaces -i https://pypi.tuna.tsinghua.edu.cn/simple #安装mqtt服务 pip3 install phao.mqtt -i https://pypi.tuna.tsinghua.edu.cn/simple #安装opencv支持 pip install opencv-contrib-python -i https://pypi.tuna.tsinghua.edu.cn/simple

issue_manage

SyntaxError: Non-ASCII character '\xe5' in file

代码中有中文,默认ASCII解析无法处理,在文件头添加。

# coding=utf-8

About

python语法学习和整理,包含python基础语法和pyqt语法。

Language
XML95.5%
Python4.2%
JavaScript0.1%
HTML0.1%
Others0.1%