python安装包及批量更新包

时间:2022-12-14 22:13:41

python安装包

pip install 使用国内镜像

# pip安装
pip install pyecharts # 源码安装 - linux
git clone https://github.com/pyecharts/pyecharts.git
cd pyecharts
#pip install -r requirements.txt
python setup.py install
# 或者执行 python install.py

  参考资料:pip更多用法

查看系统里过期的python库:

#列出所有安装的库
pip list
#列出所有过期的库
pip list --outdated
#更新过期python库
pip install pandas --upgrade --user

  

方法一: 循环

  新版本下:

import pip
from subprocess import call
from pip._internal.utils.misc import get_installed_distributions for dist in get_installed_distributions():
  call("pip install --upgrade " + dist.project_name, shell=True)

  老版本下:

import pip
from subprocess import call for dist in pip.get_installed_distributions():
call("pip install --upgrade " + dist.project_name, shell=True)

  

方法二:pip-review

pip install pip-review
pip-review --local --interactive

  

conda install nb_conda

conda upgrade --all

参考资料:

pip --upgrade批量更新过期的python库

anaconda 环境新建/删除/拷贝 jupyter notebook上使用python虚拟环境 TensorFlow   包含conda用法