似乎有几十个关于&#34的问题;为什么pip会引发SyntaxError?"并且所有答案都是"从系统shell运行它,而不是python shell。"这不是其中一个问题。我使用pip安装了django-import-export,并在输出中获得了许多SyntaxErrors。该模块本身似乎工作正常,只是想知道SystaxErrors是什么。
这是整个输出:
c:\Dev\Website>pip install django-import-export
Downloading/unpacking django-import-export
Running setup.py (path:c:\users\username\appdata\local\temp\pip_build_username\django-import-export\setup.py) egg_info for pac
kage django-import-export
Downloading/unpacking tablib (from django-import-export)
Downloading/unpacking diff-match-patch (from django-import-export)
Running setup.py (path:c:\users\username\appdata\local\temp\pip_build_username\diff-match-patch\setup.py) egg_info for package
diff-match-patch
Installing collected packages: django-import-export, tablib, diff-match-patch
Running setup.py install for django-import-export
Compiling c:\users\username\appdata\local\temp\pip_build_username\tablib\tablib\packages\xlrd3\__init__.py ...
File "c:\users\username\appdata\local\temp\pip_build_username\tablib\tablib\packages\xlrd3\__init__.py", line 855
print("mem: %s, base: %d, len: %d" % (type(self.mem), self.base, self.stream_len), file=self.logfile)
^
SyntaxError: invalid syntax
Compiling c:\users\username\appdata\local\temp\pip_build_username\tablib\tablib\packages\xlrd3\biffh.py ...
File "c:\users\username\appdata\local\temp\pip_build_username\tablib\tablib\packages\xlrd3\biffh.py", line 386
print(header, file=f)
^
SyntaxError: invalid syntax
Compiling c:\users\username\appdata\local\temp\pip_build_username\tablib\tablib\packages\xlrd3\compdoc.py ...
File "c:\users\username\appdata\local\temp\pip_build_username\tablib\tablib\packages\xlrd3\compdoc.py", line 89
print("\nCompDoc format: version=0x%04x revision=0x%04x" % (version, revision), file=logfile)
^
SyntaxError: invalid syntax
Compiling c:\users\username\appdata\local\temp\pip_build_username\tablib\tablib\packages\xlrd3\formatting.py ...
File "c:\users\username\appdata\local\temp\pip_build_username\tablib\tablib\packages\xlrd3\formatting.py", line 589
print("%2d: %r -> %r" % (i, old_rgb, new_rgb), file=book.logfile)
^
SyntaxError: invalid syntax
Compiling c:\users\username\appdata\local\temp\pip_build_username\tablib\tablib\packages\xlrd3\formula.py ...
File "c:\users\username\appdata\local\temp\pip_build_username\tablib\tablib\packages\xlrd3\formula.py", line 794
if verbose: print("tIsect pre", stack, file=bk.logfile)
^
SyntaxError: invalid syntax
Compiling c:\users\username\appdata\local\temp\pip_build_username\tablib\tablib\packages\xlrd3\sheet.py ...
File "c:\users\username\appdata\local\temp\pip_build_username\tablib\tablib\packages\xlrd3\sheet.py", line 466
print("put_cell", rowx, colx, file=self.logfile)
^
SyntaxError: invalid syntax
Compiling c:\users\username\appdata\local\temp\pip_build_username\tablib\tablib\packages\xlwt3\antlr.py ...
File "c:\users\username\appdata\local\temp\pip_build_username\tablib\tablib\packages\xlwt3\antlr.py", line 1946
print(fmt % (line,col,text), file=sys.stderr)
^
SyntaxError: invalid syntax
Running setup.py install for diff-match-patch
Successfully installed django-import-export tablib diff-match-patch
Cleaning up...
c:\Dev\Website>python -c "import import_export; print(import_export)"
<module 'import_export' from 'C:\Python27\lib\site-packages\import_export\__init__.pyc'>