Python pip安装错误。找不到 Setuptools.command
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17892071/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Pip install error. Setuptools.command not found
提问by Sam
I'm using a clean instance of Ubuntu server and would like to install some python packages in my virtualenv.
我正在使用一个干净的 Ubuntu 服务器实例,并想在我的 virtualenv 中安装一些 python 包。
I receive the following output from the command 'pip install -r requirements.txt'
我从命令“pip install -r requirements.txt”收到以下输出
Downloading/unpacking pymongo==2.5.2 (from -r requirements.txt (line 7))
Downloading pymongo-2.5.2.tar.gz (303kB): 303kB downloaded
Running setup.py egg_info for package pymongo
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 /home/redacted/env/build/pymongo
Storing complete log in /home/redacted/.pip/pip.log
Any Idea what's going on?
知道发生了什么吗?
python version 2.7.3
蟒蛇版本 2.7.3
pip version pip 1.4 from /home/redacted/env/lib/python2.7/site-packages (python 2.7)
来自 /home/redacted/env/lib/python2.7/site-packages (python 2.7) 的 pip 版本 pip 1.4
采纳答案by elyase
Try installing:
尝试安装:
sudo apt-get install python-setuptools
if this doesn't work try:
如果这不起作用,请尝试:
curl -O https://bootstrap.pypa.io/get-pip.py
python get-pip.py
Edit:If you have several (possible conflicting) python installations or environments, the following commands can be useful to debug which executables are being used:
编辑:如果您有多个(可能存在冲突的)python 安装或环境,以下命令可用于调试正在使用的可执行文件:
which python
which pip
which easy_install
They should "match". It can happen for example that you have pip installing packages for an EPD or global distribution while the current python that is being used corresponds to a local environment (or something different), in which case it might not be able to see the installed packages.
他们应该“匹配”。例如,您可能会为 EPD 或全球发行版安装 pip 软件包,而当前使用的 python 对应于本地环境(或其他环境),在这种情况下,它可能无法看到已安装的软件包。
回答by BrunoMartins
had the same problem, solved it with
有同样的问题,解决了
pip install -U setuptools
回答by Krunal Sonparate
Elaborating @elyase's Answer. First check for which python version you want to install setuptools. Normally both python versions comes default with debian or any linux distro. So, as per your requirement install setup tools using apt package manager
详细说明@elyase 的答案。首先检查您要安装 setuptools 的 python 版本。通常,debian 或任何 linux 发行版都默认提供两个 python 版本。因此,根据您的要求,使用 apt 包管理器安装安装工具
For python 2.x
对于 python 2.x
sudo apt-get install python-setuptools
For python 3.x
对于python 3.x
sudo apt-get install python3-setuptools