问题描述
我正在将一个Django应用程序部署到一个开发者服务器上,当我运行pip install requirements.txt时遇到这个错误: 追溯(最近的最后一次呼叫):
文件/ var / www / mydir / virtualenvs / dev / bin / pip,第5行,< module>
from pkg_resources import load_entry_point
ImportError:没有名为pkg_resources的模块
pkg_resources似乎与setuptools分发。最初我以为这可能不会安装到virtualenv中的python,所以我将setuptools(2.6,与Python相同的版本)安装到具有以下命令的virtualenv中的Python site-packages中。
sh setuptools-0.6c11-py2.6.egg --install-dir /var/www/mydir/virtualenvs/dev/lib/python2.6/site-packages
EDIT
这只发生在virtualenv内。如果我在virtualenv外面打开一个控制台,那么pkg_resources存在
但我仍然收到相同的错误。任何想法,为什么pkg_resources不在路径上?
我遇到相同的 ImportError
今天在尝试使用点。
为了解决这个问题,请运行安装脚本 setuptools
:
wget https://bootstrap.pypa.io/ ez_setup.py -O - | python
(或者如果没有 wget
安装(例如OS X),尝试
curl https://bootstrap.pypa.io/ez_setup.py | python
可能与 sudo
prepend。 p>
如果您有任何版本的或任何 setuptools
低于0.6,您将不得不先卸载它。*
有关详细信息,请参阅。
*如果您已经有一个工作的分发
,将其升级到兼容性包装器你到 setuptools
更容易。但是如果事情已经破了,不要试试。
I'm deploying a Django app to a dev server and am hitting this error when i run pip install requirements.txt:
Traceback (most recent call last):
File "/var/www/mydir/virtualenvs/dev/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
ImportError: No module named pkg_resources
pkg_resources appears to be distributed with setuptools. Initially I thought this might not be installed to the python in the virtualenv so I installed setuptools (2.6, same version as Python) to the Python site-packages in the virtualenv with the following command
sh setuptools-0.6c11-py2.6.egg --install-dir /var/www/mydir/virtualenvs/dev/lib/python2.6/site-packages
EDITThis only happens inside the virtualenv. If I open a console outside the virtualenv then pkg_resources is present
but I am still getting the same error. Any ideas as to why pkg_resources is not on the path?
I encountered the same ImportError
today while trying to use pip. Somehow the setuptools
package had been deleted in my Python environment.
To fix the issue, run the setup script for setuptools
:
wget https://bootstrap.pypa.io/ez_setup.py -O - | python
(or if you don't have wget
installed (e.g. OS X), try
curl https://bootstrap.pypa.io/ez_setup.py | python
possibly with sudo
prepended.)
If you have any version of distribute
, or any setuptools
below 0.6, you will have to uninstall it first.*
See Installation Instructions for further details.
* If you already have a working distribute
, upgrading it to the "compatibility wrapper" that switches you over to setuptools
is easier. But if things are already broken, don't try that.
这篇关于没有名为pkg_resources的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!