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

Mac上pyenv的安装及使用

Mac上pyenv的安装及使用

安装

brew update
brew install pyenv
报错

  git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallowgit -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch --unshallow

那就执行这2句
还报错

git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
remote: Enumerating objects: 365476, done.
remote: Counting objects: 100% (365455/365455), done.
remote: Compressing objects: 100% (147319/147319), done.
fatal: The remote end hung up unexpectedly12 MiB | 9.00 KiB/s     
fatal: early EOF
fatal: index-pack failed

需要换源
参考 https://blog.csdn.net/u013549582/article/details/120887331

## 更新 homebrew-cask(如果提示 No such file or directory 可以先跳过前三个命令)
cd "$(brew --repo)"/Library/Taps/homebrew/homebrew-cask
# 更换源
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git 
# 更新
git fetch --unshallow ## 更新 homebrew-core
cd "$(brew --repo)"/Library/Taps/homebrew/homebrew-core
# 更换源
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
# 更新
git fetch --unshallow 

再次执行
brew update
报错

==> `brew cleanup` has not been run in 30 days, running now...

需要授权

sudo chown -R $(whoami):admin /usr/local/* && sudo chmod -R g+rwx /usr/local/* 

当然这里尽量缩小授权的范围
然后执行
brew install pyenv
终于执行完了
可能需要多执行几次
然后查看版本
pyenv versions

查看可以安装的版本
pyenv install -l

安装
pyenv install 3.8.8

然后报错

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:LC_ALL = (unset),LANG = "en_CN.utf-8"are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew

需要执行

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

然后重新执行pyenv install 3.8.8
还是报错,见鬼了

python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.8.8.tar.xz...
-> https://www.python.org/ftp/python/3.8.8/Python-3.8.8.tar.xz
error: failed to download Python-3.8.8.tar.xzBUILD FAILED (OS X 13.2 using python-build 20180424)Results logged to /var/folders/jx/k9mhvtg96ggff_8_3c5bvqch0000gn/T/python-build.20240707210526.1843.logLast 10 log lines:
/var/folders/jx/k9mhvtg96ggff_8_3c5bvqch0000gn/T/python-build.20240707210526.1843 /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
warning: xz not found; consider installing `xz` package
curl: (28) Failed to connect to www.python.org port 443 after 75025 ms: Couldn't connect to server

最后还是放弃了
https://www.python.org/downloads/macos/ 下载一个版本,手动安装,哭死

换了版本之后,
python3 -V
pip3 --version

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

相关文章:

  • 【SpringBoot】IDEA查看spring bean的依赖关系
  • 项目代码优化(1)——下单逻辑
  • 探索 WebKit 的缓存迷宫:深入理解其高效缓存机制
  • JVM:介绍
  • 和鲸“101”计划领航!和鲸科技携手北中医,共话医学+AI 实验室建设及创新人才培养
  • Linux 网络抓包工具tcpdump编译
  • 『C++成长记』string模拟实现
  • 【c++】C++ IO流
  • 解密智慧校园基础数据的学年管理功能
  • Python酷库之旅-第三方库Pandas(009)
  • VPN 的入门介绍
  • 移动UI: 什么特征会被认为是简洁风格,用案例告诉你
  • 除了伦敦外,英国还有这些热门留学城市
  • 2390. 从字符串中移除星号
  • UNION、UNION ALL、INTERSECT、MINUS
  • Perl 语言开发(九):深入探索Perl语言的文件处理
  • 稀疏之美:在Mojo模型中实现特征的稀疏表示
  • 如何大幅减少 Vue.js 中的包大小和加载时间,提升用户体验!
  • 性能测试相关理解---性能测试流程(二)
  • GD32 MCU ADC采样率如何计算?
  • .mkp勒索病毒:深度解析与防范
  • 5.opencv深浅拷贝
  • C++11中新特性介绍-之(二)
  • STM32实现看门狗(HAL库)
  • 【漏洞复现】网络摄像头——弱口令
  • 视觉图像面积计算
  • Vue笔记10-其它Composition API
  • AI集成工具平台一站式体验,零门槛使用国内外主流大模型
  • 北京交通大学学报
  • 【LinuxC语言】手撕Http之处理POST请求