No module named pkg_resources

后端 未结 30 2445
一向
一向 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 08:01

    On Windows, with python 3.7, this worked for me:

    pip install --upgrade setuptools --user
    

    --user installs packages in your home directory, which doesn't require admin privileges.

    0 讨论(0)
  • 2020-11-22 08:02

    For me, it turned out to be a permissions problem on site-packages. Since it's only my dev environment, I raised the permissions and everything is working again:

    sudo chmod -R a+rwx /path/to/my/venv/lib/python2.7/site-packages/
    
    0 讨论(0)
  • After trying several of these answers, then reaching out to a colleague, what worked for me on Ubuntu 16.04 was:

    pip install --force-reinstall -U setuptools
    pip install --force-reinstall -U pip
    

    In my case, it was only an old version of pillow 3.1.1 that was having trouble (pillow 4.x worked fine), and that's now resolved!

    0 讨论(0)
  • 2020-11-22 08:06

    For me a good fix was to use --no-download option to virtualenv (VIRTUALENV_NO_DOWNLOAD=1 tox for tox.)

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

    I use CentOS 6.7, and my python was just upgrade from 2.6.6 to 2.7.11, after tried so many different answer, finally the following one does the job:

    sudo yum install python-devel
    

    Hope help someone in the same situation.

    0 讨论(0)
  • 2020-11-22 08:08

    It also happened to me. I think the problem will happen if the requirements.txt contains a "distribute" entry while the virtualenv uses setuptools. Pip will try to patch setuptools to make room for distribute, but unfortunately it will fail half way.

    The easy solution is delete your current virtualenv then make a new virtualenv with --distribute argument.

    An example if using virtualenvwrapper:

    $ deactivate
    $ rmvirtualenv yourenv
    $ mkvirtualenv yourenv --distribute
    $ workon yourenv
    $ pip install -r requirements.txt
    
    0 讨论(0)
提交回复
热议问题