使用 pip 更新指定的安装包

Python 2021-06-29 阅读 97 评论 0

使 you-get 或者 youtube-dl 等网站视频下载工具,经常会因为视频网站的更新策略,而导致下载视频失败,如:

$ you-get.exe https://www.youtube.com/watch?v=f5YzxDvm67A
you-get: [error] oops, something went wrong.
you-get: don't panic, c'est la vie. please try the following steps:
you-get:   (1) Rule out any network problem.
you-get:   (2) Make sure you-get is up-to-date.
you-get:   (3) Check if the issue is already known, on
you-get:         https://github.com/soimort/you-get/wiki/Known-Bugs
you-get:         https://github.com/soimort/you-get/issues
you-get:   (4) Run the command with '--debug' option,
you-get:       and report this issue with the full output.

有时候更新安装包能够解决问题,如果是使用 pip 安装方式,可以很简单地升级。

pip install 选项

$ pip install --help
  --user                      Install to the Python user install directory for
                              your platform. Typically ~/.local/, or
                              %APPDATA%\Python on Windows. (See the Python
                              documentation for site.USER_BASE for full
                              details.)

  -U, --upgrade               Upgrade all specified packages to the newest
                              available version. The handling of dependencies

使用 upgrade 选项更新:

pip install <package_name> --upgrade

使用 -U 简写:

pip install <package_name> -U

如果需要权限可以加上 sudo

也可以使用 user 标识,只在当前用户上安装:

pip install <package_name> --upgrade --user
最后更新 2021-08-06
MIP.watch('startSearch', function (newVal, oldVal) { if(newVal) { var keyword = MIP.getData('keyword'); console.log(keyword); // 替换当前历史记录,新增 MIP.viewer.open('/s/' + keyword, {replace: true}); setTimeout(function () { MIP.setData({startSearch: false}) }, 1000); } }); MIP.watch('goHome', function (newVal, oldVal) { MIP.viewer.open('/', {replace: false}); });