【问题标题】:pip configuration go wrong after ubuntu restartubuntu重启后pip配置出错
【发布时间】:2019-07-25 10:53:54
【问题描述】:

重启我的ubuntu 16.04后,找不到pip

我只能通过python3 -m pip freeze获得我原来的点子

如果我使用pip freeze,则会显示bash: /usr/bin/pip: No such file or directory

我通过pip install 安装了我的jupyter,但我现在无法使用jupyter notebook 命令。它显示jupyter: command not found

我确保使用sudo apt-get update,当我想使用sudo apt-get install jupyter-notebook 安装新的jupyter 时,它会显示

E: Unable to locate package jupyter-notebook

似乎几个系统配置出错?如何恢复这些?如何打开我的 jupyter?

【问题讨论】:

    标签: python ubuntu pip jupyter-notebook


    【解决方案1】:

    bash: /usr/bin/pip: 没有这样的文件或目录

    验证文件/usr/bin/pip是否存在。如果确实检查了第一行:

    head -1 /usr/bin/pip
    

    该行(称为shebang)必须类似于#!/usr/bin/python。如果不是编辑文件并修复 shebang 行以指向现有的 python 二进制文件。

    我通过pip install 安装了我的jupyter,但我现在无法使用jupyter notebook 命令。它显示jupyter: command not found

    这是因为pipjupyter 安装到了不在$PATH 中的目录中。很可能是/usr/local/bin/。检查带有pip show --files jupyter 的目录并将目录添加到当前shell 和~/.bash_profile 中的$PATH

    我想用sudo apt-get install jupyter-notebook 安装一个新的jupyter,它显示E: Unable to locate package jupyter-notebook

    试试sudo apt-get update

    【讨论】:

    • 1) 文件/usr/bin/pip 不存在,但命令python3 -m pip 会给出我之前正确的点子。 2)我确定我试过sudo apt-get update然后sudo apt-get install jupyter-notebook但仍然无法找到包
    【解决方案2】:

    pip问题已经解决了。

    原因是PATH被某种方式修改,丢失了~/.local/bin,原来的pip在这个路径,pip也在这个路径安装jupyter notebook。

    ~/.local/bin 添加到PATH 后,我可以运行pip 和jupyter notebook,简而言之这是path 问题

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-09-06
      • 1970-01-01
      • 1970-01-01
      • 2017-11-23
      • 1970-01-01
      • 1970-01-01
      • 2019-12-27
      • 2019-05-10
      相关资源
      最近更新 更多