2

MacOS 11.2.3 Python3 多余版本移除

 3 years ago
source link: http://i.lckiss.com/?p=6792
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

MacOS 11.2.3 Python3 多余版本移除

2021-04-30

玩了下 wordcloud 发现 Python 环境问题很大,一不做二不休,直接整。

首先下一个官方的稳定包装好,确保移除其他版本也不会影响到系统功能,下载地址:

https://www.python.org/downloads/mac-osx/

pkg 的包,直接一路 next 完事儿。

完成后,用命令查看下所有 Python环境 的位置

python3 -c 'import sys;print(sys.path)'

结果像这样:

当然我这里是清理干净了的结果,如果有多余版本都会在结果中展示出来,需要注意的大概就是两个位置:

  1. Framework Command Line Tools 中的 Python 版本,在官方最新的 Tools 中已经移除了 Python 版本的捆绑,直接连带 Command Line Tools 整个删除即可。删完再重新使用 xcode-select --install 命令进行安装。
  2. User 资源库下的,一般是这样的路径 /用户/用户名/资源库/Python/ 如果是折腾了很多次的,那么这里各种版本都有,直接移除 Python 整个文件夹即可。

此外,Python2 的版本也可以检查下

python -c 'import sys;print(sys.path)' 

但这里一般都是显示 2.7 版本且都在 Framework 目录下,所以不建议处理,很可能导致系统问题,如果个人用户目录下有多余版本则可以考虑移除个人版本。

一些快捷方式均在 /usr/local/bin/ 目录下,可考虑使用 ls -l 命令查看相关无效命令:

ls -l | grep py 
 ls -l | grep idle

然后使用 rm 手动删除,这样就没什么多余的版本了,以上。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK