美文网首页
Mac brew更新后 command not found: p

Mac brew更新后 command not found: p

作者: Jiacch | 来源:发表于2017-11-04 13:27 被阅读0次

    更新Homebrew

    brew upgrade
    

    Python2.7.10升级到Python2.7.14
    结果在命令行输入python后,显示

    command not found: python
    

    探究原因,发现是因为使用brew安装的python更新为python2(在电脑中已安装python3),输入python2可以进入python。进入/usr/local/bin/目录,发现下列已变更为python2。

    pip2 -> ../Cellar/python/2.7.14/bin/pip2
    python2 -> ../Cellar/python/2.7.14/bin/python2```
    

    需要我们使用 ln 命令建立python2的连接。

    ln [-bfis] existing-file-list(source) new-link
    -b    如果需要创建的目标链接已存在相同文件名,则备份
    -f    强制创建目标链接
    -i    覆盖相同文件名时提示
    -s    创建符号链接
    

    建立链接后,输入python也能跳转到python2。

    ln -s ../Cellar/python/2.7.14/bin/pip2 pip
    ln -s ../Cellar/python/2.7.14/bin/python2 python
    pip -> ../Cellar/python/2.7.14/bin/pip2
    python -> ../Cellar/python/2.7.14/bin/python2

    相关文章

      网友评论

          本文标题:Mac brew更新后 command not found: p

          本文链接:https://www.haomeiwen.com/subject/munxmxtx.html