pip install without root

66 篇文章 0 订阅
14 篇文章 0 订阅

 

  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 ~]$
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值