当前位置: 首页 > 面试题库 >

pip无法安装任何内容,错误:无效的命令“ egg_info”

靳睿
2023-03-14
问题内容

除了Mac OSX随附的Python版本外,我最近从他们的网站下载了python。这是我开始用pip安装软件包时遇到的问题。

sudo pip install -vvv pygoogle

将输出以下内容:

The directory '/Users/robot/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/robot/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting pygoogle
  Getting page https://pypi.python.org/simple/pygoogle/
  Starting new HTTPS connection (1): pypi.python.org
  "GET /simple/pygoogle/ HTTP/1.1" 200 233
  1 location(s) to search for versions of pygoogle:
  * https://pypi.python.org/simple/pygoogle/
  Getting page https://pypi.python.org/simple/pygoogle/
  "GET /simple/pygoogle/ HTTP/1.1" 200 233
  Analyzing links from page https://pypi.python.org/simple/pygoogle/
    Found link https://pypi.python.org/packages/source/p/pygoogle/pygoogle-0.6.tar.gz#md5=f9053f1b7350b899811a7c9226c8a2cb (from https://pypi.python.org/simple/pygoogle/), version: 0.6
    Skipping link http://www.google.com/apis/ (from https://pypi.python.org/simple/pygoogle/); not a file
  "GET /packages/source/p/pygoogle/pygoogle-0.6.tar.gz HTTP/1.1" 200 33672
  Downloading pygoogle-0.6.tar.gz
  Downloading from URL https://pypi.python.org/packages/source/p/pygoogle/pygoogle-0.6.tar.gz#md5=f9053f1b7350b899811a7c9226c8a2cb (from https://pypi.python.org/simple/pygoogle/)
  Running setup.py (path:/private/tmp/pip-build-1jAoXq/pygoogle/setup.py) egg_info for package pygoogle
    Running command python setup.py egg_info
    usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
       or: -c --help [cmd1 cmd2 ...]
       or: -c --help-commands
       or: -c cmd --help

    error: invalid command 'egg_info'
    Complete output from command python setup.py egg_info:
    usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
       or: -c --help [cmd1 cmd2 ...]
       or: -c --help-commands
       or: -c cmd --help

    error: invalid command 'egg_info'

    ----------------------------------------
Cleaning up...
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-1jAoXq/pygoogle
Exception information:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-7.1.0-py2.7.egg/pip/basecommand.py", line 223, in main
    status = self.run(options, args)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-7.1.0-py2.7.egg/pip/commands/install.py", line 282, in run
    requirement_set.prepare_files(finder)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-7.1.0-py2.7.egg/pip/req/req_set.py", line 334, in prepare_files
    functools.partial(self._prepare_file, finder))
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-7.1.0-py2.7.egg/pip/req/req_set.py", line 321, in _walk_req_to_install
    more_reqs = handler(req_to_install)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-7.1.0-py2.7.egg/pip/req/req_set.py", line 505, in _prepare_file
    abstract_dist.prep_for_dist()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-7.1.0-py2.7.egg/pip/req/req_set.py", line 123, in prep_for_dist
    self.req_to_install.run_egg_info()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-7.1.0-py2.7.egg/pip/req/req_install.py", line 407, in run_egg_info
    command_desc='python setup.py egg_info')
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-7.1.0-py2.7.egg/pip/utils/__init__.py", line 732, in call_subprocess
    % (command_desc, proc.returncode, cwd))
InstallationError: Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-1jAoXq/pygoogle

我已经尝试了以下所有方法,它们只是告诉我软件包setuptools已安装。

sudo pip install setuptools
sudo pip install [--upgrade] setuptools
easy_install [-U] setuptools

请注意以下命令输出:

where python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
/usr/local/bin/python

which python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python

where pip
/Library/Frameworks/Python.framework/Versions/2.7/bin/pip
/usr/local/bin/pip

which pip
/Library/Frameworks/Python.framework/Versions/2.7/bin/pip

echo $SHELL
/bin/zsh

而我的.zprofile:

# Setting PATH for Python 2.7
# The orginal version is saved in .zprofile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH

问题答案:

尝试pip install --upgrade setuptoolseasy_install -U setuptools

要么

下载此文件并执行python ez_setup.py



 类似资料:
  • 问题内容: 由于某些原因,我在用pip安装新软件包时遇到问题。我有一个OS Sierra环境,以前一切正常。现在,无论我是否使用virtualenv,我都会得到: 这不仅适用于“请求”库,还适用于所有其他库(例如django等)。 我有最新的点子: 而我的python版本是:2.7.12 此外,根据本文,我检查了是否可以卷曲PyPi网站,并且确实得到了回复。 知道有什么问题吗? 已编辑 我以如下方

  • 由于某些原因,我在安装新的pip包时遇到问题。我有一个OS Sierra环境,以前一切都很好。现在,无论我是否使用virtualenv,我都会得到: 这不仅适用于请求库,也适用于所有其他库(例如django等)。)。 我有最新的pip: 我的python版本是:2.7。12 此外,根据这篇文章,我检查了我是否可以卷曲PyPi网站,我确实得到了回复。 知道出什么问题了吗? 编辑 我执行了pip安装,

  • 问题内容: 使用在Windows 8上使用Python 2.7给我的错误: 问题: 如何解决错误?运行给出了同样的错误… 问题答案: 您可以改用ol’good 。 不是pip,而是它的一个好方面是也能够下载和安装二进制程序包,这使您无需准备VC ++。当然,这取决于二进制文件是为您的Python版本准备的。 更新: 是的,Pip现在可以安装二进制文件! 有一种新的二进制Python存档格式(whe

  • 我试图在我的EMR群集的主实例上安装pyrow,但是我总是收到这个错误。 我不知道为什么它说'命令'cmake'失败与退出状态1',事实上是肯定的,我预先安装了cmake,但我仍然得到这个错误。此外,我可以做sudo pip安装pyrow没有问题,但我得到错误时,使用sudo pip-3.4安装pyrow。我是否遗漏了什么,或者这个错误与cmake无关?我将感谢任何帮助。

  • 问题内容: 无论我尝试安装哪个软件包,都会出现此错误: 我看到了这个问题,但答案对我不起作用。我可以安装分发程序包,到目前为止,它是我唯一可以安装的程序包,但是它不能解决问题,因为在我尝试安装另一个程序包时,egg_info错误立即返回。我对此感到非常沮丧,因为我在任何地方都找不到任何帮助。我之前也已经安装了django和pip以及所有内容,但是我不得不重新安装所有内容,现在它不起作用了。任何帮助