简体   繁体   中英

pip install error setup.py egg_info

I tried to install pydot, but it gives me the following error:

$ pip install pydot


Collecting pydot
  Using cached pydot-1.0.2.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/tr/y4h4lj8n0rsgbw62f9wjgvd00000gn/T/pip-build-88dfkzmr/pydot/setup.py", line 5
        except ImportError, excp:
                          ^
    SyntaxError: invalid syntax

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/tr/y4h4lj8n0rsgbw62f9wjgvd00000gn/T/pip-build-88dfkzmr/pydot/

I think your pip is for python3 and you are trying to install a python2 library. A solution is to launch pip from the environnement you want the library on.

So in your case :

python2.7 -m pip install pydot

should do the trick.

Another one is to use 2to3 to convert your library to python3.

It's also possible that you have two different pips (I encountered this problem recently), and one of them is neither the latest one or it's really designed for the other version of Python.

In this case, you have to write the path to the necessary pip (the default one isn't working, as we see) fully (://Users/...)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM