6

I have installed yolk 0.4.3 using pip. But when I tried yolk -l to display all installed packages, it showed a syntax error

File "C:\Python32\Lib\site-packages\yolk\cli.py" line 262
print "%s %s (%s)" % (project name,dis,version,
                 ^
syntax error :invalid syntax
jxh
  • 69,070
  • 8
  • 110
  • 193
Ashish
  • 81
  • 2

3 Answers3

6

It seems you're using the package yolk (which only works Python 2). To install yolk for Python 3 use the yolk3k package:

pip install yolk3k
Dan
  • 365
  • 1
  • 3
  • 10
0

It looks like you are running a python 2 library with python 3 the versions need to match.

Steve Barnes
  • 27,618
  • 6
  • 63
  • 73
0

You have Python 2.x syntax with print when you are using Python 3.x (notice the "Python32" in "C:\Python32\Lib\site-packages\yolk\cli.py"). Below is an example written in Python 3.x:

>>> print "%s" % "a"
  File "<stdin>", line 1
     print "%s" % "a"
              ^
SyntaxError: invalid syntax
>>> print("%s" % "a")
a
>>>

As you can see, you need to use Python 3.x syntax (namely, treat print as a built-in, not a keyword).

To fix your problem, make sure your version of yolk works with your version of Python.

  • Does yolk work with Python 3? Why does pip happily install it under Python 3? – Dan Apr 20 '17 at 10:46
  • 1
    @Dan because package maintainer didn't provide information for pip that it's not supported on Py3.x. Pip itself does not guess, it acts accordingly to package metadata. – Łukasz Rogalski Apr 20 '17 at 10:56