2020-12-03 13:52:01 +08:00
|
|
|
# Python 包
|
|
|
|
|
2022-08-22 13:56:14 +08:00
|
|
|
## 1. 获取 Python 包
|
2020-12-03 13:52:01 +08:00
|
|
|
|
|
|
|
一般可到 <https://pypi.org> 搜索 Python 包,通过:
|
|
|
|
|
|
|
|
```bash
|
2021-06-10 14:20:41 +08:00
|
|
|
pip2 install <package name>[==<version>] -i http://mirrors.aliyun.com/pypi/simple/
|
2020-12-03 13:52:01 +08:00
|
|
|
# 或
|
2021-06-10 14:20:41 +08:00
|
|
|
pip3 install <package name>[==<version>] -i https://pypi.mirrors.ustc.edu.cn/simple/
|
2020-12-03 13:52:01 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
来安装包。
|
|
|
|
|
2022-08-22 13:56:14 +08:00
|
|
|
## 2. 源码安装 Python 包
|
2020-12-03 13:52:01 +08:00
|
|
|
|
|
|
|
通过 pypi.org 搜索到 Python 包后可通过跳转到官网的方式获取该包的源码,然后 Clone 源码到本地,进入到源码目录后使用以下命令进行源码安装:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
python2 setup.py install
|
|
|
|
# 或
|
|
|
|
python3 setup.py install
|
|
|
|
```
|
2021-06-04 15:36:54 +08:00
|
|
|
|
2022-08-22 13:56:14 +08:00
|
|
|
## 3. 查看已安装包
|
|
|
|
|
|
|
|
```bash
|
|
|
|
pip freeze
|
|
|
|
```
|
|
|
|
|
|
|
|
## 4. 升级安装包
|
|
|
|
|
|
|
|
```bash
|
|
|
|
pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U
|
|
|
|
```
|
|
|
|
|
|
|
|
## 5. 常用 Python 包
|
2021-06-04 15:36:54 +08:00
|
|
|
|
2021-06-08 17:44:05 +08:00
|
|
|
* kconfiglib
|
2021-06-07 10:34:07 +08:00
|
|
|
* lxml
|
2021-06-04 15:36:54 +08:00
|
|
|
* matplotlib
|
|
|
|
* notebook
|
|
|
|
* numpy
|
|
|
|
* opencv-python
|
2021-06-07 10:34:07 +08:00
|
|
|
* protobuf
|
2021-06-04 15:36:54 +08:00
|
|
|
* scikit-learn
|
|
|
|
* scipy
|
|
|
|
* sklearn
|
|
|
|
* tensorboard
|
|
|
|
* tensorflow
|