Ubuntu 18.04 为 Python 3 安装 pip
sudo apt install python3-pip
### Note buildroot host python may have conflict to this
### buildroot error: can't combine user with prefix, exec_prefix/home, or install_(plat)base
[lake@server /]$ cat > $HOME/.pydistutils.cfg <<EOF
> [install]
> user=1
> EOF
[lake@server /]$ pip install --upgrade youtube_dl
Collecting youtube_dl
Downloading https://files.pythonhosted.org/packages/a4/43/1f586e49e68f8b41c4be416302bf96ddd5040b0e744b5902d51063795eb9/youtube_dl-2021.6.6-py2.py3-none-any.whl (1.9MB)
|████████████████████████████████| 1.9MB 483kB/s
Installing collected packages: youtube-dl
WARNING: The script youtube-dl is installed in '/home/lhu3/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed youtube-dl-2021.6.6
WARNING: You are using pip version 19.3.1; however, version 21.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
[lake@server /]$ ls -l ~/.local/
total 4
drwxr-xr-x 2 lhu3 Porcelain 23 Jun 25 10:25 bin
drwxr-xr-x 4 lhu3 Porcelain 41 Jun 25 10:25 etc
drwxr-xr-x 3 lhu3 Porcelain 22 Jun 25 10:25 lib
drwxr-xr-x 19 lhu3 Porcelain 4096 Jun 25 10:25 share
[lake@server /]$ export PATH=~/.local/bin:$PATH
[lake@server ~]$ youtube-dl --help
Usage: youtube-dl [OPTIONS] URL [URL...]
Options:
General Options:
-h, --help Print this help text and exit
--version Print program version and exit
-U, --update Update this program to latest version. Make sure that you have sufficient
permissions (run with sudo if needed)
[lhu3@zch127bld08 ~]$ pip install --upgrade pip --user
Collecting pip
Using cached https://files.pythonhosted.org/packages/47/ca/f0d790b6e18b3a6f3bd5e80c2ee4edbb5807286c21cdd0862ca933f751dd/pip-21.1.3-py3-none-any.whl
Installing collected packages: pip
Successfully installed pip-21.1.3
[lhu3@zch127bld08 ~]$ which pip
~/.local/bin/pip
[lhu3@zch127bld08 ~]$ pip install --upgrade youtube_dl --user
Requirement already satisfied: youtube_dl in /data/sdb/lhu3/.local/lib/python3.7/site-packages (2021.6.6)
[lhu3@zch127bld08 ~]$