李守中

Table of Contents

1 pip 安装

一般来说 windows 上安装 python3 以后默认就带 pip 了。

linux 有些系统不预装 pip,需要 sudo apt install python3-pip 手动安装。

2 pip 换源

linux 下修改 ~/.pip/pip.conf ( 没有就创建一个 ),内容如下:

[global]
index-url = https://mirrors.aliyun.com/pypi/simple/

windows 下创建 C:\Users\<user>\AppData\Roaming\pip\pip.ini 文件,内容如下

[global]
index-url = https://mirrors.aliyun.com/pypi/simple/

3 包管理

pip install <package-name> 安装包。

pip uninstall <package-name> 卸载包。

pip freeze > requirements.txt 依赖导出到 requirements.txt 文件。

pip install -r requirements.txt 根据 requirements.txt 安装依赖。



Last Update: 2023-05-18 Thu 09:12

Contact: [email protected]     Generated by: Emacs 27.1 (Org mode 9.3)

若正文中无特殊说明,本站内容遵循: 知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议