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

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-core

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

执行命令:

# 
source .bash_profile 

#
python -V 

#
pip


http://www.kler.cn/a/108170.html

相关文章:

  • qt QVideoWidget详解
  • 【学习】【HTML】HTML、XML、XHTML
  • 机器学习基础02_特征工程
  • 【p2p、分布式,区块链笔记 DAM】GUN/SEA(Security, Encryption, Authorization) 模块genkey
  • 解决:WSL2可视化opencv和pyqt冲突:QObject::moveToThread
  • Docker入门系列——Docker-Compose
  • Linux网络基础
  • IOC课程整理-15 Spring 类型转换
  • JavaScript_对象_Function_定义与参数
  • 文章分类管理接口
  • Gin vs Beego: Golang的Web框架之争
  • Vue 路由传参和获取参数的方法
  • C++类模板再学习
  • 闭包通俗解释,Demo(Go Java Python)
  • winodos下使用VS2022编译eclipse-paho.mqtt.c并演示简单使用的 demo
  • pytest方法间变量值传递--request夹具
  • ajax有哪些优缺点?
  • Azure - 机器学习:使用 Apache Spark 进行交互式数据整理
  • MySQL篇---第五篇
  • SSM宾馆客房管理系统开发mysql数据库web结构java编程计算机网页源码eclipse项目
  • 基于SSM和VUE的留守儿童信息管理系统
  • vue列表新增存储假数据
  • OpenCV学习(二)——OpenCV中绘图功能
  • 【孙哥说Spring5】第三章 Spring的事务处理
  • 图解Kafka高性能之谜(五)
  • 【计算机网络笔记】DNS报文格式