Error with pointing to correct python version: virtualenvwrapper.sh

后端 未结 3 1708
走了就别回头了
走了就别回头了 2021-02-04 13:31

I get this error when I boot up terminal:

Last login: Thu Apr  9 19:49:08 on ttys001
/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Conte         


        
3条回答
  •  忘掉有多难
    2021-02-04 14:13

    Today I got this error after a series of steps, the first was to install wormhole (https://magic-wormhole.readthedocs.io/en/latest/welcome.html#example) which installed Python 3.8. I started having other errors which I resolved doing a brew uninstall python@2

    brew uninstall python@2
    Uninstalling /usr/local/Cellar/python@2/2.7.15_2... (4,814 files, 84.8MB)
    python@2 HEAD_3 is still installed.
    Run `brew uninstall --force python@2` to remove all versions.
    
    brew uninstall --force python@2
    Uninstalling python@2... (822B)
    

    At this point the error in this question appeared:

    Last login: Wed May 27 11:33:08 on ttys025
    /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: No module named virtualenvwrapper
    virtualenvwrapper.sh: There was a problem running the initialization hooks.
    
    If Python could not import the module virtualenvwrapper.hook_loader,
    check that virtualenvwrapper has been installed for
    VIRTUALENVWRAPPER_PYTHON=/usr/bin/python and that PATH is
    set properly.
    

    My solution was to :

    ls -l /usr/local/bin/python3
    lrwxr-xr-x  1 neo  admin  34 Nov 27 16:46 /usr/local/bin/python3 -> ../Cellar/python/3.7.5/bin/python3
    
    
    ln -s ../Cellar/python/3.7.5/bin/python3 /usr/local/bin/python
    

    Now the error seems to be gone. I am not sure if this is a good solution, I am interested in the feedback of those people who understand/know brew better than me.

提交回复
热议问题