Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
224 views
in Technique[技术] by (71.8m points)

python - pip fails to install anything, error: invalid command 'egg_info'

I recently downloaded python from their website in addition to the Python version that already comes with Mac OSX. This is when I began to have problems installing packages with pip.

sudo pip install -vvv pygoogle

Will output the following:

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

I have already tried all of the following, they just tell me the package setuptools is already installed.

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

Please note the following commands output:

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

And my .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
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Try pip install --upgrade setuptools or easy_install -U setuptools

or

Download this file and execute python ez_setup.py


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...