• MAC下安装Python


    MAC基本信息:

    执行命令:

    brew install cmake protobuf rust python@3.10 git wget

    遇到以下问题:

    ==> Downloading https://mirrors.aliyun.com/homebrew/homebrew-bottles/rust-1.59.0

    Already downloaded: /Users/xxxx/Library/Caches/Homebrew/downloads/fd122b92cd4fe9249e35f891eec3e352f95a168d986493f0b2ecb0ba95922c37--rust-1.59.0.monterey.bottle.tar.gz

    Error: python@3.10: the bottle needs the Apple Command Line Tools to be installed.

      You can install them, if desired, with:

        xcode-select --install

    You can try to install from source with:

      brew install --build-from-source python@3.10

    Please note building from source is unsupported. You will encounter build

    failures with some formulae. If you experience any issues please create pull

    requests instead of asking for help on Homebrew's GitHub, Twitter or any other

    official channels.

    ==> Downloading https://mirrors.aliyun.com/homebrew/homebrew-bottles/wget-1.21.3

    Already downloaded: /Users/xxxx/Library/Caches/Homebrew/downloads/b7c9518741b5ffbedb680ca184dd793dac01c932d4efdfdfbe88593987186784--wget-1.21.3.monterey.bottle.tar.gz

    fatal: not in a git directory

    Error: Command failed with exit 128: git

    根据这个错误做搜索,发现需要执行以下命令 :

    brew -v

    获取如下信息:

    Homebrew 3.5.2-113-g5d3501f

    fatal: unsafe repository ('/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core' is owned by someone else)

    To add an exception for this directory, call:

    git config --global --add safe.directory /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core

    Homebrew/homebrew-core (no Git repository)

    fatal: unsafe repository ('/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask' is owned by someone else)

    To add an exception for this directory, call:

    git config --global --add safe.directory /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask

    Homebrew/homebrew-cask (no Git repository)

    按照上述信息执行:

    1. git config --global --add safe.directory /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
    2. git config --global --add safe.directory /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask

    重新执行以下命令:

    brew install cmake protobuf rust python@3.10 git wget

     判断python是否安装成功:

    python3 -V

    安装效果:

    Python 3.9.13

    修改别名,执行命令

    vim ~/.bash_profile 

    添加下面信息:

    alias python=python3

    alias pip=pip3

    执行命令:

    1. #
    2. source .bash_profile
    3. #
    4. python -V
    5. #
    6. pip

  • 相关阅读:
    华为obs上传下载-Java版 2023-11-23
    linux环境下文件传输与环境命令
    【Python】《Python编程:从入门到实践 (第2版) 》笔记-Chapter11-测试代码
    探索Web3前沿:革新性算力共享平台,重塑数字资源利用新时代
    《认知觉醒:开启自我改变的原动力》
    搭建强化学习的机械臂MuJoCo环境以及urdf转xml文件方法
    [面试直通版]操作系统核心之存储系统(下)
    Scala----For循环---02
    Leetcode—136.只出现一次的数字【简单】
    对实现移动应用界面设计的思考
  • 原文地址:https://blog.csdn.net/weiliuhong1/article/details/134087411