【问题标题】:Pip install error. Setuptools.command not found点安装错误。找不到 Setuptools.command
【发布时间】:2013-07-27 08:32:50
【问题描述】:

我正在使用一个干净的 Ubuntu 服务器实例,并希望在我的 virtualenv 中安装一些 python 包。

我从命令“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

知道发生了什么吗?

python 版本 2.7.3

来自 /home/redacted/env/lib/python2.7/site-packages (python 2.7) 的 pip 版本 pip 1.4

【问题讨论】:

    标签: python python-2.7 pip pymongo


    【解决方案1】:

    尝试安装:

    sudo apt-get install python-setuptools
    

    如果这不起作用,请尝试:

    curl -O https://bootstrap.pypa.io/get-pip.py
    python get-pip.py
    

    编辑:如果您有多个(可能存在冲突的)python 安装或环境,则以下命令可用于调试正在使用的可执行文件:

    which python
    which pip
    which easy_install
    

    它们应该“匹配”。例如,您可能会为 EPD 或全局发行版安装 pip 包,而当前使用的 python 对应于本地环境(或其他环境),在这种情况下,它可能无法看到已安装的包。

    【讨论】:

    • 我尝试过,无论是在全球范围内,还是在我的 virutalenv 中使用“pip install setuptools”。还是没有运气。
    • @Sam,现在呢?
    • 还是不行,虽然现在我已经全局安装了pip。
    • @Sam,你在环境中运行了 easy_install 和 python 吗?
    • 你能解释一下为什么在虚拟环境中使用它会起作用吗?
    【解决方案2】:

    遇到了同样的问题,解决了

    pip install -U setuptools
    

    【讨论】:

      【解决方案3】:

      详细说明@elyase 的答案。 首先检查您要安装 setuptools 的 python 版本。 通常,这两个 python 版本都默认使用 debian 或任何 linux 发行版。 因此,根据您的要求,使用 apt 包管理器安装设置工具

      对于 python 2.x

      sudo apt-get install python-setuptools
      

      对于 python 3.x

      sudo apt-get install python3-setuptools
      

      【讨论】:

        【解决方案4】:

        这些说明为我解决了问题:

        先输入这些命令

            pip install --upgrade pip
            pip install --upgrade wheel
            pip install setuptools
        

        然后尝试安装需要setuptools的包。

        【讨论】:

          猜你喜欢
          • 2012-03-31
          • 2017-10-01
          • 2018-12-19
          • 2015-09-30
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多