使用 pip 更新指定的安装包
使 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