pip命令


install

普通安装

1
pip install --timeout 8000 package

使用镜像安装

使用国内镜像源

1
2
3
pip install 包名 -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
这个是豆瓣源
--trusted-host pypi.douban.com 这是为了获得ssl证书的认证,要不然会报错

国内镜像源

1
2
3
4
5
6
7
8
9
10
11
清华:https://pypi.tuna.tsinghua.edu.cn/simple

阿里云:http://mirrors.aliyun.com/pypi/simple/

中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/

华中理工大学:http://pypi.hustunique.com/

山东理工大学:http://pypi.sdutlinux.org/

豆瓣:http://pypi.douban.com/simple/

直接修改文件

1
2
3
4
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com

windows下,直接在user目录中创建一个pip目录,如:C:\Users\xx\pip,新建文件pip.ini。内容同上。本机win10操作系统,目录:C:\Users\DELL\AppData\Roaming\pip\pip.ini

pip更新

python -m pip install –upgrade pip

python版本替换批量迁移模块

1
2
3
4
# 旧版本Scripts路径下执行
pip freeze > requirements.txt
# 新版本Scripts路径下执行
pip install -r requirements.txt -i 镜像源
1
2
3
4
5
6
-- requirements.txt格式
alembic==0.8.6
bleach==1.4.3
click==6.6
dominate==2.2.1
Flask==0.11.1

包更新

1
pip install -U 包名

本文标题:pip命令

文章作者:TTYONG

发布时间:2020年04月11日 - 09:04

最后更新:2020年05月22日 - 09:05

原始链接:http://tianyong.fun/pip%E5%91%BD%E4%BB%A4.html

许可协议: 转载请保留原文链接及作者。

多少都是爱
0%