User Tools

Site Tools


library:python:command

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

library:python:command [2022/05/02 00:32] (current)
Line 1: Line 1:
 +====== Python 常用命令 ======
  
 +----
 +
 +===== 更换国内pypi镜像 =====
 +
 +国内pypi镜像
 +阿里:https://mirrors.aliyun.com/pypi/simple
 +豆瓣:http://pypi.douban.com/simple
 +中国科学技术大学:http://pypi.mirrors.ustc.edu.cn/simple/
 +指定单次安装源
 +pip install <包名> -i http://pypi.v2ex.com/simple
 +
 +指定全局安装源
 +在unix和macos,配置文件为:$HOME/.pip/pip.conf
 +在windows上,配置文件为:%HOME%\pip\pip.ini
 +
 +[global]
 +timeout = 6000
 +  index-url = http://pypi.douban.com/simple
 +
 +卸载包
 +pip uninstall <包名> 或 pip uninstall -r requirements.txt
 +
 +===== 升级包 =====
 +
 +pip install -U <包名>
 +
 +或:pip install <包名> --upgrade
 +  
 +===== 升级pip =====
 +
 +pip install -U pip  
 +
 +pip install -U pip -i https://mirrors.aliyun.com/pypi/simple
 +
 +===== 重装pip =====
 +python -m pip install --upgrade --force-reinstall pip -i https://mirrors.aliyun.com/pypi/simple
 +
 +===== 安装包 =====
 +pip install zeroconf -i https://pypi.tuna.tsinghua.edu.cn/simple
 +
 +
 +===== Reinstall pip =====
 +
 +  python -m ensurepip
 +  python -m pip install --upgrade pip
library/python/command.txt · Last modified: 2022/05/02 00:32 (external edit)