您好我在使用pydrive https://pypi.python.org/pypi/PyDrive时收到此错误,json键与脚本(a.py)的目录相同。
[XX@example.com user]# pip install PyDrive
Requirement already satisfied (use --upgrade to upgrade): PyDrive in /usr/lib/python2.6/site-packages/PyDrive-1.0.0-py2.6.egg
Requirement already satisfied (use --upgrade to upgrade): google-api-python-client>=1.2 in /usr/lib/python2.6/site-packages (from PyDrive)
Requirement already satisfied (use --upgrade to upgrade): PyYAML>=3.0 in /usr/lib64/python2.6/site-packages (from PyDrive)
Requirement already satisfied (use --upgrade to upgrade): httplib2>=0.8 in /usr/lib/python2.6/site-packages (from google-api-python-client>=1.2->PyDrive)
Cleaning up...
[XX@example.com user]# vi a.py
[XX@example.com user]# cat a.py
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
gauth = GoogleAuth()
gauth.LocalWebserverAuth()
drive = GoogleDrive(gauth)
[XX@example.com user]# python a.py
Traceback (most recent call last):
File "a.py", line 1, in <module>
from pydrive.auth import GoogleAuth
File "/usr/lib/python2.6/site-packages/PyDrive-1.0.0-py2.6.egg/pydrive/auth.py", line 14, in <module>
from oauth2client.tools import ClientRedirectHandler
File "/usr/lib/python2.6/site-packages/oauth2client/tools.py", line 27, in <module>
import argparse
ImportError: No module named argparse
[XX@example.com user]#
对此有何想法?
答案 0 :(得分:1)
argparse不随Python 2.6一起提供(但附带2.7)
pip install argparse