Broken references in Virtualenvs

前端 未结 26 1099
一整个雨季
一整个雨季 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:23

    What fixed it for me was just uninstalling python3 and pipenv then reinstalling them.

    brew uninstall pipenv
    brew uninstall python3
    brew install python3 
    brew install pipenv
    
    0 讨论(0)
  • 2020-11-27 09:24

    I recently faced this. None of the above solutions worked for me. Seems it wasn't actually Python's problem. When I was running

    aws s3 ls

    I was getting following error:

    dyld: Library not loaded: @executable_path/../.Python

    This means, the library aws executable is pointing towards is either doesn't exist or is corrupted, thus I uninstalled and reinstalled aws-cli following instructions from this link and it worked!!

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

    After trying a few things, this worked for me:

    go to your virtualenv directory (but don't run workon):

    cd ~/.virtualenv/name_of_broken_venv
    

    Now delete these files:

    rm -rf .Python bin/python* lib/python2.7/* include/python2.7
    

    Then to rebuild your venv, run:

    virtualenv .
    workon name_of_broken_venv
    pip freeze
    

    You should now see a list of your installed packages again.

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

    Using Python 2.7.10.

    A single command virtualenv path-to-env does it. documentation

    $ virtualenv path-to-env
    Overwriting path-to-env/lib/python2.7/orig-prefix.txt with new content
    New python executable in path-to-env/bin/python2.7
    Also creating executable in path-to-env/bin/python
    Installing setuptools, pip, wheel...done.
    
    0 讨论(0)
  • 2020-11-27 09:26

    I came across the same issue when I was pointing my python run time from 2 to 3 on my mac, pointing the alias python to python 3 path. I then recreate a new virtualenv and re-install those packages i need for my project. For my use case i have had a python program writing to google sheet. Clean up a few packages that are different from python 2 implementation and wa la, things started working again.

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

    All the answers are great here, I tried a couple of solutions mentioned above by Ryan, Chris and couldn't resolve the issue, so had to follow a quick and dirty way.

    1. rm -rf <project dir> (or mv <project dir> <backup projct dir> if you want to keep a backup)
    2. git clone <project git url>
    3. Move on!

    Nothing novel here, but it makes life easier!

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