python3版本降级

环境:

MacOS 11.1

说明:

已经安装了python3.9

但是在安装pip 安装python airtest第三方库,报error:No matching distribution found for opencv-contrib-python

经过调查发现,目前该库不支持python3.8,所以现在python3.9已经降级到了3.6

[En]

After investigation, it is found that the library does not support python3.8 at present, so now the python3.9 is downgraded to 3.6

目标:mac有自带的python2,在降级python3的同时,不希望系统自带的python2受到影响

1、移除现有Python

bogon:~ lz1$ brew unlink python3
Unlinking /usr/local/Cellar/python@3.9/3.9.1_6... 25 symlinks removed

2、安装3.6.5

brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb

参考文档:详解python 降级到3.6终极解决方案

删除非brew安装的python3方法

注意这1步

删除系统环境变量配置文件中与PYTHON相关的配置:

[En]

Delete the configuration related to python in the system environment variable configuration file:

sudo vi ~/.bash_profile
  • 1

输入系统密码后,光标移动到下面的Python配置,按i键删除共4行配置,按[Esc]键跳转到命令模式,按冒号键,然后按WQ Enter,即可保存正在退出vi的编辑状态。

[En]

After entering the system password, the cursor moves to the following Python configuration, press I to delete a total of 4 lines of configuration, press the [ESC] key to jump to the command mode, press the colon button, and then press wq enter, you can save the editing state of exiting vi.

# Setting PATH for Python 3.7
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.7/bin:${PATH}"
export PATH

python3版本降级
这里可以看到python3.6.5的安装目录删除掉3.6的文件夹

python3版本降级

undefined

Original: https://www.cnblogs.com/kaerxifa/p/14277979.html
Author: wangju003
Title: python3版本降级

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/7380/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

发表回复

登录后才能评论
免费咨询
免费咨询
扫码关注
扫码关注
联系站长

站长Johngo!

大数据和算法重度研究者!

持续产出大数据、算法、LeetCode干货,以及业界好资源!

2022012703491714

微信来撩,免费咨询:xiaozhu_tec

分享本页
返回顶部