pip使用

  • 查看已安装软件包列表
pip list
  • 查看单个包的信息
pip show pandas
  • 更新软件包
pip install -U pandas
or
pip install --upgrade pandas
  • 指定源添加信任安装软件包
pip install beautifulsoup4 -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
  • 指定版本、指定源安装软件包
pip install urllib3==1.25.10 -i https://pypi.tuna.tsinghua.edu.cn/simple
  • 卸载软件包
pip uninstall numpy
  • 官方源
https://pypi.python.org/simple

国内源

  • 全局源配置

如果你希望修改全局的pip源配置,可以使用以下命令:

pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
  • 当前源配置

如果你只希望修改当前用户的pip源配置,可以使用以下命令:

pip config set install.index-url https://pypi.python.org/simple
  • 添加新的pip源

除了修改现有的pip源之外,你还可以添加新的pip源作为备选。可以使用以下命令添加新的pip源:

pip config set install.extra-index-url  https://mirrors.aliyun.com/pypi/simple/
  • 删除新源
pip config unset install.extra-index-url
  • 阿里云
 https://mirrors.aliyun.com/pypi/simple/
  • 清华大学
https://pypi.tuna.tsinghua.edu.cn/simple/
  • 中国科技大学
https://pypi.mirrors.ustc.edu.cn/simple/
  • 华中理工大学
http://pypi.hustunique.com/
  • 山东理工大学
http://pypi.sdutlinux.org/ 
  • 豆瓣
http://pypi.douban.com/simple/
Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐