python安装包及批量更新包
python安装包
批量下载及安装包
批量下载安装包: pip download -d save_path(下载包保存的地址) -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/ 批量安装包: pip install --no-index --find-links=[存放包的目录名] -r requirements.txt
# 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 pip show pandas #更新过期python库 pip install pandas --upgrade --user pip install pandas==版本 pip uninstall pandas conda upgrade --all conda install nb_conda conda uninstall pyqt5
方法一: 循环
新版本下:
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
python删除 pkgs中无用包
Google讨论组里推荐用 conda clean -p
删除未使用的的包;实际 conda clean -a
更强力些。
参考资料:
anaconda 环境新建/删除/拷贝 jupyter notebook上使用python虚拟环境 TensorFlow 包含conda用法