No module named pkg_resources

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

    I had this problem when I had activated my virtualenv as a different user than the one who created it. It seems to be a permission problem. I discovered this when I tried the answer by @cwc and saw this in the output:

    Installing easy_install script to /path/env/bin
    error: /path/env/bin/easy_install: Permission denied
    

    Switching back to the user that created the virtualenv, then running the original pip install command went without problems. Hope this helps!

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

    Looks like they have moved away from bitbucket and are now on github (https://github.com/pypa/setuptools)

    Command to run is:

    wget https://bootstrap.pypa.io/ez_setup.py -O - | sudo python
    
    0 讨论(0)
  • 2020-11-22 08:08

    In my case, I had 2 python versions installed initially and later I had deleted the older one. So while creating the virtual environment

    virtualenv venv
    

    was referring to the uninstalled python

    What worked for me

    python3 -m virtualenv venv
    

    Same is true when you are trying to use pip.

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

    I had this problem today as well. I only got the problem inside the virtual env.

    The solution for me was deactivating the virtual env, deleting and then uninstalling virtualenv with pip and reinstalling it. After that I created a new virtual env for my project, then pip worked fine both inside the virtual environment as in the normal environment.

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

    just reinstall your setuptools by :

    $ sudo wget https://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz#md5=7df2a529a074f613b509fb44feefefe74e
    $ tar -zxvf setuptools-0.6c11.tar.gz
    $ cd setuptools-0.6c11/
    $ sudo python setup.py build
    $ sudo python setup.py install
    $ sudo pip install --upgrade setuptools
    

    then everything will be fine.

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

    In CentOS 6 installing the package python-setuptools fixed it.

    yum install python-setuptools
    
    0 讨论(0)
提交回复
热议问题