How to link home brew python version and set it as default

后端 未结 10 609
春和景丽
春和景丽 2020-12-07 15:57

I just switched from MacPorts to HomeBrew. After installing all the required XCode versions and other software I tried installing python using homebrew: I think it successfu

10条回答
  •  -上瘾入骨i
    2020-12-07 16:17

    I think you have to be precise with which version you want to link with the command brew link python like:

    brew link python 3
    

    It will give you an error like that:

    Linking /usr/local/Cellar/python3/3.5.2... 
    Error: Could not symlink bin/2to3-3.5
    Target /usr/local/bin/2to3-3.5
    already exists. 
    

    You may want to remove it:

    rm '/usr/local/bin/2to3-3.5'
    

    To force the link and overwrite all conflicting files:

    brew link --overwrite python3
    

    To list all files that would be deleted:

    brew link --overwrite --dry-run python3
    

    but you have to copy/paste the command to force the link which is:

    brew link --overwrite python3
    

    I think that you must have the version (the newer) installed.

提交回复
热议问题