Switching Python version (3.9 → 3.8) installed by Homebrew

前端 未结 2 1136
暗喜
暗喜 2021-01-25 17:36

It’s a very similar situation like described here, but vice versa. I have Python 3.8 installed via Homebrew and updated that to 3.9:

% brew list --formula | grep          


        
相关标签:
2条回答
  • 2021-01-25 18:11

    Well, sometimes it helps to ask the question to find the solution on your own – one of the great things of StackOverflow, by the way.

    The hint is in the warning of pipenv: "Your Pipfile requires python_version 3.9".

    I simply did

    rm Pipfile
    rm Pipfile.lock
    

    and then it worked:

    pipenv install google-ads
    

    Well, at least pipenv worked correctly with Python 3.8. There is still an issue with google-ads, but that's another story.

    Probably it would have been enough to change the Pipfile:

    [requires]
    python_version = "3.8"
    
    0 讨论(0)
  • 2021-01-25 18:20

    I'm glad you were able to fix the issue your own way, but let me add some advice. Generally speaking, downgrading Python (or really any program) is not usually a supported operation. Upgrading may upgrade dependencies in other packages that are not backwards compatible with older versions of Python or other dependencies. In short, you shouldn't even want to "downgrade" a package, ever.

    Instead, you should use multiple independent environments e.g. with virtualenv so that, if ever you need a lower version for some reason, you can replace the entire environment with a new one of lower version (note the subtle difference from "downgrading" because you are using a new environment completely).

    0 讨论(0)
提交回复
热议问题