[英]ImportError: No module named setuptools.command on Mac OS X within virtualenv
Trying to install a Python pip package (Django Rest Framework docs, drfdocs
) on Mac OSX within a virtualenv: 尝试在virtualenv中在Mac OSX上安装Python pip包(Django Rest Framework文档,
drfdocs
):
Here are the relevant versions of pip, python, easy_install: 以下是pip,python,easy_install的相关版本:
$ virtualenv --version
1.11.4
$ mkvirtualenv test
New python executable in test/bin/python
Installing setuptools, pip...done.
(test)$ python --version; which python
Python 2.7.10
/Users/me/.virtualenvs/test/bin/python
(test)$ pip --version; which pip
pip 1.5.4 from /Users/me/.virtualenvs/test/lib/python2.7/site-packages (python 2.7)
/Users/me/.virtualenvs/test/bin/pip
(test)$ easy_install --version; which easy_install
setuptools 2.2
/Users/me/.virtualenvs/test/bin/easy_install
(test)$ python -c "import setuptools.command; print setuptools.command"
<module 'setuptools.command' from '/Users/me/.virtualenvs/test/lib/python2.7/site-packages/setuptools/command/__init__.pyc'>
And here's the error: 这是错误:
$ pip install drfdocs
Downloading/unpacking drfdocs
Downloading drfdocs-0.0.11.tar.gz (771kB): 771kB downloaded
Running setup.py (path:/Users/me/.virtualenvs/test/build/drfdocs/setup.py) egg_info for package drfdocs
Traceback (most recent call last):
File "<string>", line 3, in <module>
ImportError: No module named setuptools.command
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 3, in <module>
ImportError: No module named setuptools.command
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /Users/me/.virtualenvs/test/build/drfdocs
Storing debug log for failure in /Users/me/.pip/pip.log
I tried a variety of fixes from other Stack Overflow answers here , but none worked. 我尝试了各种其他堆栈溢出的答案修复这里 ,但没有奏效。
$ pip install -U setuptools
did not help either. 也没有帮助。
EDIT : As requested: 编辑 :根据要求:
(test)$ python -c "import setuptools; print setuptools.__file__; print setuptools.__version__"
/Users/me/.virtualenvs/test/lib/python2.7/site-packages/setuptools/__init__.pyc
2.2
EDIT #2 : I tried pip install pip --upgrade
so now I'm on pip==8.1.2
. 编辑#2 :我试过
pip install pip --upgrade
所以现在我正在pip==8.1.2
。
Now when I try to install I get a slightly different error: 现在,当我尝试安装时,我得到一个稍微不同的错误:
(test)$ python
Python 2.7.10 (default, Oct 23 2015, 19:19:21)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import setuptools
>>> exit()
(test)$ pip --version
pip 8.1.2 from /Users/me/.virtualenvs/test/lib/python2.7/site-packages (python 2.7)
(test)$ pip install drfdocs
Collecting drfdocs
Using cached drfdocs-0.0.11.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named setuptools
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/kc/00fkv5q91vz815b2jycc8cv40000gn/T/pip-build-olnkAD/drfdocs/
Still doesn't make sense why this is happening though. 仍然没有理由为什么会发生这种情况。
This is a bug in package. 这是包中的错误。 See issue #120
见问题#120
Wait for v0.1.0 or download package from PyPI , remove site
directory from this package, install patched package. 等待v0.1.0或从PyPI下载包,从此包中删除
site
目录,安装修补包。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.