No module named pkg_resources

后端 未结 30 2441
一向
一向 2020-11-22 07:22

I\'m deploying a Django app to a dev server and am hitting this error when I run pip install -r requirements.txt:

Traceback (most recent call la         


        
相关标签:
30条回答
  • 2020-11-22 07:50

    A lot of answers are recommending the following but if you read through the source of that script, you'll realise it's deprecated.

    wget https://bootstrap.pypa.io/ez_setup.py -O - | python
    

    If your pip is also broken, this won't work either.

    pip install setuptools
    

    I found I had to run the command from Ensure pip, setuptools, and wheel are up to date, to get pip working again.

    python -m pip install --upgrade pip setuptools wheel
    
    0 讨论(0)
  • 2020-11-22 07:51

    the simple resoluition is that you can use conda to upgrade setuptools or entire enviroment. (Specially for windows user.)

    conda upgrade -c anaconda setuptools
    

    if the setuptools is removed, you need to install setuptools again.

    conda install -c anaconda setuptools
    

    if these all methodes doesn't work, you can upgrade conda environement. But I do not recommend that you need to reinstall and uninstall some packages because after that it will exacerbate the situation.

    0 讨论(0)
  • 2020-11-22 07:51

    I came across this answer when I was trying to follow this guide for OSX. What worked for me was, after running python get-pip, I had to ALSO easy_install pip. That fixed the issue of not being able to run pip at all. I did have a bunch of old macport stuff installed. That may have conflicted.

    0 讨论(0)
  • 2020-11-22 07:51

    I ran into this problem after updating my Ubuntu build. It seems to have gone through and removed set up tools in all of my virtual environments.

    To remedy this I reinstalled the virtual environment back into the target directory. This cleaned up missing setup tools and got things running again.

    e.g.:

    ~/RepoDir/TestProject$ virtualenv TestEnvironmentDir
    
    0 讨论(0)
  • 2020-11-22 07:53

    I had this error earlier and the highest rated answer gave me an error trying to download the ez_setup.py file. I found another source so you can run the command:

    curl http://peak.telecommunity.com/dist/ez_setup.py | python
    

    I found that I also had to use sudo to get it working, so you may need to run:

    sudo curl http://peak.telecommunity.com/dist/ez_setup.py | sudo python
    

    I've also created another location that the script can be downloaded from:

    https://gist.github.com/ajtrichards/42e73562a89edb1039f3

    0 讨论(0)
  • 2020-11-22 07:55

    If you are encountering this issue with an application installed via conda, the solution (as stated in this bug report) is simply to install setup-tools with:

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