美文网首页
2019-02-20

2019-02-20

作者: 锁阿姨 | 来源:发表于2019-02-20 17:24 被阅读0次

    MacOS安装python3的各种报错信息

    mac自带的python版本是2.7.10,安装qrcode时报错,考虑到版本太老,2020年就停止维护了,就安装python3,两台电脑安装时遇到了不一样的问题

    brew install python3

    1. 报错如下:

    Error: An unexpected error occurred during the `brew link` step
    The formula built, but is not symlinked into /usr/local
    Permission denied @ dir_s_mkdir - /usr/local/Frameworks
    Error: Permission denied @ dir_s_mkdir - /usr/local/Frameworks
    Mac-mini-97:baseline_ios_resign_enterprise admin$ sudo brew install python3
    Password:
    Error: Running Homebrew as root is extremely dangerous and no longer supported.
    
    解决方案:
    
        sudo mkdir /usr/local/Frameworks
        sudo chown $(whoami):admin /usr/local/Frameworks
        brew link python3
    

    python3安装成功:

    Mac-mini-97:Frameworks admin$ python3
    Python 3.7.2 (default, Feb 20 2019, 11:29:21) 
    [Clang 10.0.0 (clang-1000.11.45.5)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    

    按说安装python3时应该会直接安装pip3,但是不知道什么原因pip3没有安装成功

    Mac-mini-97:site-packages admin$ pip --version
    pip 19.0.2 from /Library/Python/2.7/site-packages/pip-19.0.2-py2.7.egg/pip (python 2.7)
    Mac-mini-97:site-packages admin$ pip3
    -bash: pip3: command not found
    

    执行下面的命令安装pip3

    Mac-mini-97:site-packages admin$ brew postinstall python3
    

    2. 执行brew install python3时报错如下

    Error: Could not link:
    /usr/local/share/doc/homebrew
    
    Please delete these paths and run `brew update`.
    Error: Xcode alone is not sufficient on High Sierra.
    Install the Command Line Tools:
      xcode-select --install
    

    解决方案:

    1. rm -rf /usr/local/share/doc/homebrew
    2. brew update
    3. xcode-select --install
    4. brew install python3
    

    这次执行完brew install python3后pip3也自动安装好了

    相关文章

      网友评论

          本文标题:2019-02-20

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