通过pip安装googlemaps模块时出现语法错误

0 投票
1 回答
737 浏览
提问于 2025-04-18 11:06

我刚开始学习Python,想在Python里安装Google地图的模块,但遇到了语法错误。下面是错误信息。请帮帮我。

(gmapenv) C:\Python\Virtual Environment\gmapenv\Scripts>pip install GoogleMaps
Downloading/unpacking GoogleMaps
  Running setup.py egg_info for package GoogleMaps
    Traceback (most recent call last):
      File "<string>", line 16, in <module>
      File "C:\Python\Virtual Environment\gmapenv\build\GoogleMaps\setup.py", li
ne 18, in <module>
        import googlemaps
      File "googlemaps\googlemaps.py", line 471
        print main.__doc__
                 ^
    SyntaxError: invalid syntax
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 16, in <module>

  File "C:\Python\Virtual Environment\gmapenv\build\GoogleMaps\setup.py", line 1
8, in <module>

    import googlemaps

  File "googlemaps\googlemaps.py", line 471

    print main.__doc__

             ^

SyntaxError: invalid syntax

----------------------------------------
Command python setup.py egg_info failed with error code 1 in C:\Python\Virtual E
nvironment\gmapenv\build\GoogleMaps
Storing complete log in C:\Users\Vimal\pip\pip.log

1 个回答

0

看起来你是用python3来运行python2的代码。试着重新安装python吧:https://www.python.org/download/releases/2.7/

撰写回答