mirror of
https://github.com/jaywcjlove/reference.git
synced 2025-06-15 19:51:20 +08:00
@ -240,6 +240,7 @@ Quick Reference
|
||||
[Cargo](./docs/cargo.md)<!--rehype:style=background: rgb(71 71 71);&class=tag&data-lang=Rust-->
|
||||
[Homebrew](./docs/homebrew.md)<!--rehype:style=background: rgb(252 185 87);&class=tag&data-lang=macOS-->
|
||||
[Pacman](./docs/pacman.md)<!--rehype:style=background: rgb(24 147 209);&class=tag&data-lang=archlinux&class=contributing-->
|
||||
[pip](./docs/pip.md)<!--rehype:style=background: rgb(24 147 209);&class=tag&data-lang=Python&class=contributing-->
|
||||
[YUM](./docs/yum.md)<!--rehype:style=background: rgb(86 86 123);-->
|
||||
[SDKMAN](./docs/sdkman.md)<!--rehype:style=background: rgb(0 118 198);-->
|
||||
<!--rehype:class=home-card-->
|
||||
|
61
docs/pip.md
Normal file
61
docs/pip.md
Normal file
@ -0,0 +1,61 @@
|
||||
pip 备忘清单
|
||||
===
|
||||
|
||||
这份 pip 备忘清单汇总了 Python 包管理的常用命令,涵盖安装、卸载、版本控制、依赖管理及镜像加速等操作,助你高效掌控开发环境。
|
||||
|
||||
入门
|
||||
---
|
||||
|
||||
### 基础命令
|
||||
<!--rehype:wrap-class=col-span-2-->
|
||||
|
||||
命令 | 说明
|
||||
:- | :-
|
||||
`pip install package_name` | 安装指定的包
|
||||
`pip install requests-2.22.0-py2.py3-none-any.whl` | 从本地的 wheel 文件安装包
|
||||
`pip install git+https://github.com/psf/requests.git` | 从 Git 仓库安装包
|
||||
`pip install /home/user/src/requests` | 从目录中安装包
|
||||
`pip uninstall package_name` | 卸载指定的包
|
||||
`pip list` | 查看已安装的包列表
|
||||
`pip show package_name` | 查看某个包的详细信息
|
||||
`pip search keyword` | 搜索 PyPI 包(新版 pip 已弃用,建议用 [pypi.org](https://pypi.org))
|
||||
<!--rehype:className=left-align-->
|
||||
|
||||
### 版本控制
|
||||
|
||||
命令 | 说明
|
||||
:- | :-
|
||||
`pip install package==1.2.3` | 安装指定版本
|
||||
`pip install "package>=1.0,<2.0"` | 安装满足条件的版本
|
||||
`pip install package!=2.21.0` | 安装包,但排除某个特定版本
|
||||
`pip install --upgrade package` | 升级包到最新版本
|
||||
<!--rehype:className=style-list-->
|
||||
|
||||
### 依赖文件操作
|
||||
|
||||
命令 | 说明
|
||||
:- | :-
|
||||
`pip freeze` | 导出当前环境的所有包及版本
|
||||
`pip freeze > requirements.txt` | 保存依赖列表到文件
|
||||
`pip install -r requirements.txt` | 从文件安装依赖
|
||||
<!--rehype:className=style-list-->
|
||||
|
||||
### 高级选项
|
||||
|
||||
命令 | 说明
|
||||
:- | :-
|
||||
`pip install .` | 安装当前目录中的包(`setup.py` 或 `pyproject.toml`)
|
||||
`pip install -e .` | 安装当前项目为可编辑模式(开发用)
|
||||
`pip cache dir` | 查看 pip 缓存目录
|
||||
`pip cache purge` | 清除 pip 缓存
|
||||
`pip check` | 检查依赖冲突
|
||||
<!--rehype:className=style-list-->
|
||||
|
||||
### 使用镜像源
|
||||
|
||||
命令 | 说明
|
||||
:- | :-
|
||||
`pip install -i https://pypi.org/simple package` | 使用官方源安装
|
||||
`pip install -i https://pypi.tuna.tsinghua.edu.cn/simple package` | 使用清华镜像安装
|
||||
`pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple` | 永久设置默认镜像
|
||||
<!--rehype:className=style-list-->
|
@ -11,7 +11,7 @@
|
||||
"prepare": "husky",
|
||||
"postinstall": "npm run cpy",
|
||||
"build": "refs-cli && npm run cpy",
|
||||
"start": "refs-cli --watch",
|
||||
"start": "npm run cpy && refs-cli --watch",
|
||||
"cpy": "cpy 'appicon/*.png' dist/appicon",
|
||||
"prettier": "prettier --write '**/*.{mjs,css,json,prettierrc,lintstagedrc}'",
|
||||
"markdownlint": "npx markdownlint-cli --fix ./docs/*.md"
|
||||
|
Reference in New Issue
Block a user