Broken references in Virtualenvs

前端 未结 26 1097
一整个雨季
一整个雨季 2020-11-27 08:53

I recently installed a bunch of dotfiles on my Mac along with some other applications (I changed to iTerm instead of Terminal, and Sublime as my default text editor) but eve

相关标签:
26条回答
  • 2020-11-27 09:35

    Anyone who is using pipenv (and you should!) can simply use these two commands — without having the venv activated:

    rm -rf `pipenv --venv` # remove the broken venv
    pipenv install --dev   # reinstall the venv from pipfile 
    
    0 讨论(0)
  • 2020-11-27 09:36

    I tried the top few methods, but they didn't work, for me, which were trying to make tox work. What eventually worked was:

    sudo pip install tox
    

    even if tox was already installed. The output terminated with:

    Successfully built filelock
    Installing collected packages: py, pluggy, toml, filelock, tox
    Successfully installed filelock-3.0.10 pluggy-0.11.0 py-1.8.0 toml-0.10.0 tox-3.9.0
    
    0 讨论(0)
  • 2020-11-27 09:36

    When you are running into this issue on a freshly created virtualenv, it might be that your python version installed by brew is "unlinked".

    You can fix this for example by running: brew link python@3.8 (but specify your speficic python version)

    You can also run brew doctor, it will tell you if you have unlinked stuff and how to fix this.

    0 讨论(0)
  • 2020-11-27 09:38

    It appears the proper way to resolve this issue is to run

     pip install --upgrade virtualenv
    

    after you have upgraded python with Homebrew.

    This should be a general procedure for any formula that installs something like python, which has it's own package management system. When you install brew install python, you install python and pip and easy_install and virtualenv and so on. So, if those tools can be self-updated, it's best to try to do so before looking to Homebrew as the source of problems.

    0 讨论(0)
  • 2020-11-27 09:38

    The problem for me(a MacOS user) is that brew updated the Python and virtualenvs links to the old version which was deleted.

    We can check and fix it by

    >> ls -al ~/.virtualenvs/<your-virtual-env>/.Python
    .Python -> /usr/local/Cellar/python/<old-version>/Frameworks/Python.framework/Versions/3.7/Python
    >> rm ~/.virtualenvs/<your-virtual-env>/.Python
    >> ln -s  /usr/local/Cellar/python/<new-version>/Frameworks/Python.framework/Versions/3.7/Python ~/.virtualenvs/<your-virtual-env>/.Python
    
    0 讨论(0)
  • 2020-11-27 09:39

    I had a similar issue and i solved it by just rebuilding the virtual environment with virtualenv .

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