如何从Mac OS删除除3.7之外的所有Python版本?

问题描述 投票:0回答:1

我通过升级到Python 3.8并安装新版本的Anaconda彻底破坏了我的依赖关系。我正在尝试使用需要Python 3.7的软件包,但由于某种原因实际上不能强制我的终端使用3.7。我只想从系统中删除所有非3.7版本的Python,以消除出现此错误的可能性。

例如:

如果我这样做

pip3 install otree

我收到以下错误:

Collecting otree
  Using cached https://files.pythonhosted.org/packages/d5/71/21e6639f07cf1b5aea0869872b61fe8ef7198caa3d3b3f09f2102471e586/otree-2.5.5.tar.gz
    ERROR: Command errored out with exit status 1:
     command: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/99/yq4kk62j6ks2pmqh366mgyfj57twk_/T/pip-install-m3cm6vha/otree/setup.py'"'"'; __file__='"'"'/private/var/folders/99/yq4kk62j6ks2pmqh366mgyfj57twk_/T/pip-install-m3cm6vha/otree/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/99/yq4kk62j6ks2pmqh366mgyfj57twk_/T/pip-install-m3cm6vha/otree/pip-egg-info
         cwd: /private/var/folders/99/yq4kk62j6ks2pmqh366mgyfj57twk_/T/pip-install-m3cm6vha/otree/
    Complete output (3 lines):

    This version of oTree requires Python 3.7.x.

    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Otree需要Python 3.7,但是您可以在目录中默认情况下使用3.8来查看终端。我应该能够使用“ pip”而不是“ pip3”解决此问题,但是即使安装了以下版本,我也会遇到相同的错误:

(base) edefilippis-mbp:~ edefilippis$ python --version
Python 3.7.4
(base) edefilippis-mbp:~ edefilippis$ python3 --version
Python 3.8.1

我只想从系统中删除3.8.1,以消除所有依赖性问题。最好的方法是什么?

python pip anaconda
1个回答
0
投票

((1)删除第三方Python 2.7框架#进行必要的更改sudo rm -rf /Library/Frameworks/Python.framework/Versions/2.7

((2)删除Python 2.7应用程序目录sudo rm -rf“ / Applications / Python 2.7”

(3)删除/ usr / local / bin中的符号链接,该链接指向此Python版本。看到他们使用ls -l / usr / local / bin | grep'../Library/Frameworks/Python.framework/Versions/2.7'然后运行以下命令删除所有链接:

cd / usr / local / bin /ls -l / usr / local / bin | grep'../Library/Frameworks/Python.framework/Versions/2.7'| awk'{print $ 9}'| tr -d @ | xargs rm

((4)如有必要,编辑您的Shell配置文件以删除添加的内容 /Library/Frameworks/Python.framework/Versions/2.7到PATH环境文件。根据您使用的外壳,可能会修改以下任何文件:〜/ .bash_login,〜/ .bash_profile,〜/ .cshrc,〜/ .profile,〜/ .tcshrc和/或〜/ .zprofile。

© www.soinside.com 2019 - 2024. All rights reserved.