Pip的使用

pip 设置超时时间

pip --default-timeout=1000 install Pillow

临时使用
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package
注意,simple 不能少, 是 https 而不是 http

设为默认
升级 pip 到最新的版本 (>=10.0.0) 后进行配置:

pip install pip -U
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
如果您到 pip 默认源的网络连接较差,临时使用本镜像站来升级 pip:
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple

安装本地whl

下载好对应的whl文件
cmd到存放whl的文件目录
pip install ***.whl

pip list有,却无法import

说明系统上装了多个python,并且python.exe和pip.exe不是用的同个python的,查看系统环境变量,看Path里的pythonxx和pythonxx\Scripts是否是同一个路径下的;如有多个的情况下,靠前的有效。

Python的Excel包

$ pip install openpyxl
官网首页:https://openpyxl.readthedocs.io/en/stable/

使用文档:https://openpyxl.readthedocs.io/en/stable/usage.html

你可能感兴趣的:(Pip的使用)