代码之家  ›  专栏  ›  技术社区  ›  David L

无法安装pip2

  •  0
  • David L  · 技术社区  · 7 年前

    我不小心卸载了pip2,无法成功地重新安装它。

    我试着用 apt-get install python-pip pip 命令,它默认为蟒蛇的pip,如果我尝试运行 pip2 命令,我得到以下错误:

    bash: /usr/local/bin/pip2: No such file or directory

    如果重要的话,这台电脑就是Ubuntu 16.04。

    2 回复  |  直到 7 年前
        1
  •  0
  •   Kyle    7 年前

    看来你已经卸载了 pip 皮普 在bash中默认为蟒蛇的 皮普 . 这是因为默认情况下,蟒蛇会在 .bashrc 看起来像这样:

    # added by Anaconda3 5.3.1 installer
    # >>> conda init >>>
    # !! Contents within this block are managed by 'conda init' !!
    # [some stuff]
    # <<< conda init <<<
    

    然后重启终端, 皮普 python

    # before commenting stuff out in .bashrc
    $ which python
    /home/username/.anaconda3/bin/python
    $ which pip2
    /home/username/.anaconda3/bin/pip2
    
    # after commenting stuff out in .bashrc and restarting
    $ which python
    /usr/bin/python
    $ which pip2
    /usr/bin/pip2
    
        2
  •  0
  •   SACHIN CHAVAN    7 年前

    要安装pip,请安全下载 get-pip.py

    curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
    

    然后运行以下命令:

    python get-pip.py
    

    参考文献: Installation pip 19.0.1 documentation