Skip to content

Commit cb8d9df

Browse files
committed
feat: add pip.md #83 #964
1 parent fb3e277 commit cb8d9df

File tree

3 files changed

+63
-1
lines changed

3 files changed

+63
-1
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ Quick Reference
240240
[Cargo](./docs/cargo.md)<!--rehype:style=background: rgb(71 71 71);&class=tag&data-lang=Rust-->
241241
[Homebrew](./docs/homebrew.md)<!--rehype:style=background: rgb(252 185 87);&class=tag&data-lang=macOS-->
242242
[Pacman](./docs/pacman.md)<!--rehype:style=background: rgb(24 147 209);&class=tag&data-lang=archlinux&class=contributing-->
243+
[pip](./docs/pip.md)<!--rehype:style=background: rgb(24 147 209);&class=tag&data-lang=Python&class=contributing-->
243244
[YUM](./docs/yum.md)<!--rehype:style=background: rgb(86 86 123);-->
244245
[SDKMAN](./docs/sdkman.md)<!--rehype:style=background: rgb(0 118 198);-->
245246
<!--rehype:class=home-card-->

docs/pip.md

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
pip 备忘清单
2+
===
3+
4+
这份 pip 备忘清单汇总了 Python 包管理的常用命令,涵盖安装、卸载、版本控制、依赖管理及镜像加速等操作,助你高效掌控开发环境。
5+
6+
入门
7+
---
8+
9+
### 基础命令
10+
<!--rehype:wrap-class=col-span-2-->
11+
12+
命令 | 说明
13+
:- | :-
14+
`pip install package_name` | 安装指定的包
15+
`pip install requests-2.22.0-py2.py3-none-any.whl` | 从本地的 wheel 文件安装包
16+
`pip install git+https://github.com/psf/requests.git` | 从 Git 仓库安装包
17+
`pip install /home/user/src/requests` | 从目录中安装包
18+
`pip uninstall package_name` | 卸载指定的包
19+
`pip list` | 查看已安装的包列表
20+
`pip show package_name` | 查看某个包的详细信息
21+
`pip search keyword` | 搜索 PyPI 包(新版 pip 已弃用,建议用 [pypi.org](https://pypi.org)
22+
<!--rehype:className=left-align-->
23+
24+
### 版本控制
25+
26+
命令 | 说明
27+
:- | :-
28+
`pip install package==1.2.3` | 安装指定版本
29+
`pip install "package>=1.0,<2.0"` | 安装满足条件的版本
30+
`pip install package!=2.21.0` | 安装包,但排除某个特定版本
31+
`pip install --upgrade package` | 升级包到最新版本
32+
<!--rehype:className=style-list-->
33+
34+
### 依赖文件操作
35+
36+
命令 | 说明
37+
:- | :-
38+
`pip freeze` | 导出当前环境的所有包及版本
39+
`pip freeze > requirements.txt` | 保存依赖列表到文件
40+
`pip install -r requirements.txt` | 从文件安装依赖
41+
<!--rehype:className=style-list-->
42+
43+
### 高级选项
44+
45+
命令 | 说明
46+
:- | :-
47+
`pip install .` | 安装当前目录中的包(`setup.py``pyproject.toml`
48+
`pip install -e .` | 安装当前项目为可编辑模式(开发用)
49+
`pip cache dir` | 查看 pip 缓存目录
50+
`pip cache purge` | 清除 pip 缓存
51+
`pip check` | 检查依赖冲突
52+
<!--rehype:className=style-list-->
53+
54+
### 使用镜像源
55+
56+
命令 | 说明
57+
:- | :-
58+
`pip install -i https://pypi.org/simple package` | 使用官方源安装
59+
`pip install -i https://pypi.tuna.tsinghua.edu.cn/simple package` | 使用清华镜像安装
60+
`pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple` | 永久设置默认镜像
61+
<!--rehype:className=style-list-->

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"prepare": "husky",
1212
"postinstall": "npm run cpy",
1313
"build": "refs-cli && npm run cpy",
14-
"start": "refs-cli --watch",
14+
"start": "npm run cpy && refs-cli --watch",
1515
"cpy": "cpy 'appicon/*.png' dist/appicon",
1616
"prettier": "prettier --write '**/*.{mjs,css,json,prettierrc,lintstagedrc}'",
1717
"markdownlint": "npx markdownlint-cli --fix ./docs/*.md"

0 commit comments

Comments
 (0)