# python-demo **Repository Path**: adwyxx/python-demo ## Basic Information - **Project Name**: python-demo - **Description**: python 学习 - **Primary Language**: Python - **License**: MulanPSL-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-01-19 - **Last Updated**: 2024-09-10 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # python-demo ## 一、介绍 Python 学习笔记 > `Python 3.12.2`+`PyQt6` ## 二、目录 ### 2.1 Python 基础 1. [变量和数据类型](./01-basic/1-variable.py) 2. [Decimal](./01-basic/2-decimal.py) 3. [运算符](./01-basic/3-operator.py) 4. [字符串](./01-basic/4-strings.py) 5. [程序控制语句](./01-basic/5-code_structure.py) 6. [函数](./01-basic/6-function.py) 7. [装饰器(装饰函数)](./01-basic/7-decorator.py) 8. [数据结构](./01-basic/8-data_structure.py) 9. [模块+包](./01-basic/9-module.py) 10. [错误和异常](./01-basic/10-errors.py) 11. [面向对象的编程](./01-basic/11-class.py) ### 2.2 Python 高级 ## 三、Setup ```bash # 项目使用 pipreqs 管理依赖,安装 pipreqs 组件 pip install pipreqs # 运行以下命令生成requirements.txt文件: pipreqs . --encoding=utf8 --force # 安装依赖 pip install -r requirements.txt # 将当前环境中的所有库及其版本写入 requirements.txt 文件中 pip freeze > requirements.txt ``` ### pip 国内镜像设置 ```bash # 清华大学 pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple/ # 阿里云 pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/ ``` ### pip 常用命令 ```bash # 安装包‌: pip install 包名命令 # 例如:pip install numpy #将安装NumPy库。 # 如果需要安装特定版本的包,可以使用 pip install 包名==版本号 # 如: pip install matplotlib==3.4.1 将安装Matplotlib库的3.4.1版本。 # ‌升级包‌: pip install --upgrade 包名 # 或 pip install -U 包名命 # 卸载包‌: pip uninstall 包名 # 查看包信息‌:查看已安装包的详细信息,包括版本号、安装路径等。 pip show 包名 # 列出已安装的包‌:列出所有已安装的包及其版本号。 pip list # 或者 pip freeze # ‌下载包但不安装‌:下载包的.whl文件,但不自动安装。 # 之后可以使用pip install 包名-whl文件名来安装这个下载的.whl文件。 pip download 包名 # 指定源安装‌:如果默认的PyPI源速度较慢或无法访问,可以指定一个镜像源进行安装,例如使用阿里云镜像源: pip install package_name -i https://mirrors.aliyun.com/pypi/simple/ ```