Python 2.7 尝试导入时出现httplib2无效语法错误

Python 2.7 尝试导入时出现httplib2无效语法错误,python-2.7,apache-beam,httplib2,Python 2.7,Apache Beam,Httplib2,我正在尝试设置一个ApacheBeam管道,在运行代码时不断出现以下错误 Traceback (most recent call last): File "C:/Users/Student/PycharmProjects/Event-Log/Event-Pipeline.py", line 5, in <module> import apache_beam as beam File "C:\Users\Student\Anaconda3\envs\apache_bea

我正在尝试设置一个ApacheBeam管道,在运行代码时不断出现以下错误

Traceback (most recent call last):
  File "C:/Users/Student/PycharmProjects/Event-Log/Event-Pipeline.py", line 5, in <module>
    import apache_beam as beam
  File "C:\Users\Student\Anaconda3\envs\apache_beam\lib\site-packages\apache_beam\__init__.py", line 78, in <module>
    from apache_beam import io
  File "C:\Users\Student\Anaconda3\envs\apache_beam\lib\site-packages\apache_beam\io\__init__.py", line 34, in <module>
    from apache_beam.io.gcp.bigquery import *
  File "C:\Users\Student\Anaconda3\envs\apache_beam\lib\site-packages\apache_beam\io\gcp\bigquery.py", line 114, in <module>
    from apache_beam.internal.gcp import auth
  File "C:\Users\Student\Anaconda3\envs\apache_beam\lib\site-packages\apache_beam\internal\gcp\auth.py", line 26, in <module>
    from oauth2client.client import GoogleCredentials
  File "C:\Users\Student\Anaconda3\envs\apache_beam\lib\site-packages\oauth2client\client.py", line 38, in <module>
    from oauth2client import transport
  File "C:\Users\Student\Anaconda3\envs\apache_beam\lib\site-packages\oauth2client\transport.py", line 17, in <module>
    import httplib2
  File "C:\Users\Student\Anaconda3\envs\apache_beam\lib\site-packages\httplib2\__init__.py", line 352
    print('%s:' % h, end=' ', file=self._fp)
                        ^
SyntaxError: invalid syntax

看起来您正试图使用Python 2解释器中的Python 3模块(其中,
print
是一条语句,而不是一个普通函数)。
  for h, v in msg.items():
      print('%s:' % h, end=' ', file=self._fp)
      if isinstance(v, Header):
          print(v.encode(maxlinelen=self._maxheaderlen), file=self._fp)
      else:
          # Header's got lots of smarts, so use it.
          header = Header(v, maxlinelen=self._maxheaderlen, charset='utf-8',
                          header_name=h)
          print(header.encode(), file=self._fp)
  # A blank line always separates headers from body
  print(file=self._fp)