当前位置: 首页 > news >正文

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)

按照上述信息执行:

git config --global --add safe.directory /usr/local/Homebrew/Library/Taps/homebrew/homebrew-coregit 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

执行命令:

# 
source .bash_profile #
python -V #
pip

http://www.lryc.cn/news/213204.html

相关文章:

  • Android NDK开发详解之JNI中的库文件
  • KNN模型
  • Python 学习1 基础
  • 网络协议--TCP的超时与重传
  • Thread
  • FOC系列(二)----继续学习DRV8301芯片
  • A. Directional Increase -前缀和与差分理解 + 思维
  • openpnp - java调试环境 - 最好只保留一套jdk环境
  • AI技术的钓鱼邮件有多强
  • vue/react项目刷新页面出现404报错的原因及解决办法
  • 黑客技术(网络安全)——如何高效学习
  • 53.MongoDB分片集群高级集群架构详解
  • Servlet 上下文参数
  • ChatGPT正在测试原生文件分析功能,DALL·E 3能P图啦!
  • 三相马达的电机故障维护
  • 【易售小程序项目】后端部署、Uniapp项目Web部署
  • prometheus监控kafka
  • 【STL】:list用法详解
  • SQL Wildcards 通配符
  • 入门必学 | R语言for循环的常规应用
  • metaRTC集成flutter ui demo编译指南
  • int怎么转成QString?
  • JavaScript进阶(二十九): 走近 es6 之 new.target
  • JVM虚拟机:堆结构的逻辑分区
  • RabbitMQ学习02
  • android中的Package安装、卸载、更新替换流程
  • 思维训练第三课 反意疑问句
  • nvm安装步骤
  • 关于比较级(内含名词比较级)
  • 【算法|动态规划 | 线性dp | 最长上升子序列模型No.1】AcWing1017.怪盗基德的滑翔翼 AcWing1014.登山