我正在按照指示这里使用 Google 的 API 来启动并运行一些示例代码以写入电子表格,但我认为 gdata 安装不正确。运行时,python setup.py install
我收到一条警告,提示 install_requires 是一个未知的分发选项(尽管 easy_install 已正确安装),但它似乎安装正确。输出如下:
C:\gdata\gdata>python setup.py install
C:\Python27\lib\distutils\dist.py:267: UserWarning: Unknown distribution option:
'install_requires'
warnings.warn(msg)
running install
running build
running build_py
copying src\atom\auth.py -> build\lib\atom
copying src\atom\client.py -> build\lib\atom
copying src\atom\core.py -> build\lib\atom
copying src\atom\data.py -> build\lib\atom
copying src\atom\http.py -> build\lib\atom
copying src\atom\http_core.py -> build\lib\atom
copying src\atom\http_interface.py -> build\lib\atom
copying src\atom\mock_http.py -> build\lib\atom
copying src\atom\mock_http_core.py -> build\lib\atom
copying src\atom\mock_service.py -> build\lib\atom
copying src\atom\service.py -> build\lib\atom
copying src\atom\token_store.py -> build\lib\atom
copying src\atom\url.py -> build\lib\atom
copying src\atom\__init__.py -> build\lib\atom
copying src\gdata\apps_property.py -> build\lib\gdata
copying src\gdata\auth.py -> build\lib\gdata
copying src\gdata\client.py -> build\lib\gdata
copying src\gdata\core.py -> build\lib\gdata
copying src\gdata\data.py -> build\lib\gdata
copying src\gdata\gauth.py -> build\lib\gdata
copying src\gdata\sample_util.py -> build\lib\gdata
copying src\gdata\service.py -> build\lib\gdata
copying src\gdata\test_config.py -> build\lib\gdata
copying src\gdata\test_data.py -> build\lib\gdata
copying src\gdata\urlfetch.py -> build\lib\gdata
copying src\gdata\__init__.py -> build\lib\gdata
copying src\gdata\Crypto\test.py -> build\lib\gdata\Crypto
copying src\gdata\Crypto\__init__.py -> build\lib\gdata\Crypto
copying src\gdata\Crypto\Cipher\__init__.py -> build\lib\gdata\Crypto\Cipher
copying src\gdata\Crypto\Hash\HMAC.py -> build\lib\gdata\Crypto\Hash
copying src\gdata\Crypto\Hash\MD5.py -> build\lib\gdata\Crypto\Hash
copying src\gdata\Crypto\Hash\SHA.py -> build\lib\gdata\Crypto\Hash
copying src\gdata\Crypto\Hash\__init__.py -> build\lib\gdata\Crypto\Hash
copying src\gdata\Crypto\Protocol\AllOrNothing.py -> build\lib\gdata\Crypto\Prot
ocol
copying src\gdata\Crypto\Protocol\Chaffing.py -> build\lib\gdata\Crypto\Protocol
copying src\gdata\Crypto\Protocol\__init__.py -> build\lib\gdata\Crypto\Protocol
copying src\gdata\Crypto\PublicKey\DSA.py -> build\lib\gdata\Crypto\PublicKey
copying src\gdata\Crypto\PublicKey\ElGamal.py -> build\lib\gdata\Crypto\PublicKe
y
copying src\gdata\Crypto\PublicKey\pubkey.py -> build\lib\gdata\Crypto\PublicKey
copying src\gdata\Crypto\PublicKey\qNEW.py -> build\lib\gdata\Crypto\PublicKey
copying src\gdata\Crypto\PublicKey\RSA.py -> build\lib\gdata\Crypto\PublicKey
copying src\gdata\Crypto\PublicKey\__init__.py -> build\lib\gdata\Crypto\PublicK
ey
copying src\gdata\Crypto\Util\number.py -> build\lib\gdata\Crypto\Util
copying src\gdata\Crypto\Util\randpool.py -> build\lib\gdata\Crypto\Util
copying src\gdata\Crypto\Util\RFC1751.py -> build\lib\gdata\Crypto\Util
copying src\gdata\Crypto\Util\test.py -> build\lib\gdata\Crypto\Util
copying src\gdata\Crypto\Util\__init__.py -> build\lib\gdata\Crypto\Util
copying src\gdata\acl\data.py -> build\lib\gdata\acl
copying src\gdata\acl\__init__.py -> build\lib\gdata\acl
copying src\gdata\alt\appengine.py -> build\lib\gdata\alt
copying src\gdata\alt\app_engine.py -> build\lib\gdata\alt
copying src\gdata\alt\__init__.py -> build\lib\gdata\alt
copying src\gdata\analytics\client.py -> build\lib\gdata\analytics
copying src\gdata\analytics\data.py -> build\lib\gdata\analytics
copying src\gdata\analytics\service.py -> build\lib\gdata\analytics
copying src\gdata\analytics\__init__.py -> build\lib\gdata\analytics
copying src\gdata\apps\apps_property_entry.py -> build\lib\gdata\apps
copying src\gdata\apps\client.py -> build\lib\gdata\apps
copying src\gdata\apps\data.py -> build\lib\gdata\apps
copying src\gdata\apps\service.py -> build\lib\gdata\apps
copying src\gdata\apps\__init__.py -> build\lib\gdata\apps
copying src\gdata\apps\adminsettings\service.py -> build\lib\gdata\apps\adminset
tings
copying src\gdata\apps\adminsettings\__init__.py -> build\lib\gdata\apps\adminse
ttings
copying src\gdata\apps\audit\service.py -> build\lib\gdata\apps\audit
copying src\gdata\apps\audit\__init__.py -> build\lib\gdata\apps\audit
copying src\gdata\apps\emailsettings\client.py -> build\lib\gdata\apps\emailsett
ings
copying src\gdata\apps\emailsettings\data.py -> build\lib\gdata\apps\emailsettin
gs
copying src\gdata\apps\emailsettings\service.py -> build\lib\gdata\apps\emailset
tings
copying src\gdata\apps\emailsettings\__init__.py -> build\lib\gdata\apps\emailse
ttings
copying src\gdata\apps\groups\client.py -> build\lib\gdata\apps\groups
copying src\gdata\apps\groups\data.py -> build\lib\gdata\apps\groups
copying src\gdata\apps\groups\service.py -> build\lib\gdata\apps\groups
copying src\gdata\apps\groups\__init__.py -> build\lib\gdata\apps\groups
copying src\gdata\apps\migration\service.py -> build\lib\gdata\apps\migration
copying src\gdata\apps\migration\__init__.py -> build\lib\gdata\apps\migration
copying src\gdata\apps\multidomain\client.py -> build\lib\gdata\apps\multidomain
copying src\gdata\apps\multidomain\data.py -> build\lib\gdata\apps\multidomain
copying src\gdata\apps\multidomain\__init__.py -> build\lib\gdata\apps\multidoma
in
copying src\gdata\apps\organization\client.py -> build\lib\gdata\apps\organizati
on
copying src\gdata\apps\organization\data.py -> build\lib\gdata\apps\organization
copying src\gdata\apps\organization\service.py -> build\lib\gdata\apps\organizat
ion
copying src\gdata\apps\organization\__init__.py -> build\lib\gdata\apps\organiza
tion
copying src\gdata\blogger\client.py -> build\lib\gdata\blogger
copying src\gdata\blogger\data.py -> build\lib\gdata\blogger
copying src\gdata\blogger\service.py -> build\lib\gdata\blogger
copying src\gdata\blogger\__init__.py -> build\lib\gdata\blogger
copying src\gdata\books\data.py -> build\lib\gdata\books
copying src\gdata\books\service.py -> build\lib\gdata\books
copying src\gdata\books\__init__.py -> build\lib\gdata\books
copying src\gdata\calendar\client.py -> build\lib\gdata\calendar
copying src\gdata\calendar\data.py -> build\lib\gdata\calendar
copying src\gdata\calendar\service.py -> build\lib\gdata\calendar
copying src\gdata\calendar\__init__.py -> build\lib\gdata\calendar
copying src\gdata\calendar_resource\client.py -> build\lib\gdata\calendar_resour
ce
copying src\gdata\calendar_resource\data.py -> build\lib\gdata\calendar_resource
copying src\gdata\calendar_resource\__init__.py -> build\lib\gdata\calendar_reso
urce
copying src\gdata\codesearch\service.py -> build\lib\gdata\codesearch
copying src\gdata\codesearch\__init__.py -> build\lib\gdata\codesearch
copying src\gdata\contacts\client.py -> build\lib\gdata\contacts
copying src\gdata\contacts\data.py -> build\lib\gdata\contacts
copying src\gdata\contacts\service.py -> build\lib\gdata\contacts
copying src\gdata\contacts\__init__.py -> build\lib\gdata\contacts
copying src\gdata\contentforshopping\client.py -> build\lib\gdata\contentforshop
ping
copying src\gdata\contentforshopping\data.py -> build\lib\gdata\contentforshoppi
ng
copying src\gdata\contentforshopping\__init__.py -> build\lib\gdata\contentforsh
opping
copying src\gdata\docs\client.py -> build\lib\gdata\docs
copying src\gdata\docs\data.py -> build\lib\gdata\docs
copying src\gdata\docs\service.py -> build\lib\gdata\docs
copying src\gdata\docs\__init__.py -> build\lib\gdata\docs
copying src\gdata\dublincore\data.py -> build\lib\gdata\dublincore
copying src\gdata\dublincore\__init__.py -> build\lib\gdata\dublincore
copying src\gdata\exif\__init__.py -> build\lib\gdata\exif
copying src\gdata\finance\data.py -> build\lib\gdata\finance
copying src\gdata\finance\service.py -> build\lib\gdata\finance
copying src\gdata\finance\__init__.py -> build\lib\gdata\finance
copying src\gdata\geo\data.py -> build\lib\gdata\geo
copying src\gdata\geo\__init__.py -> build\lib\gdata\geo
copying src\gdata\health\service.py -> build\lib\gdata\health
copying src\gdata\health\__init__.py -> build\lib\gdata\health
copying src\gdata\media\data.py -> build\lib\gdata\media
copying src\gdata\media\__init__.py -> build\lib\gdata\media
copying src\gdata\notebook\data.py -> build\lib\gdata\notebook
copying src\gdata\notebook\__init__.py -> build\lib\gdata\notebook
copying src\gdata\oauth\rsa.py -> build\lib\gdata\oauth
copying src\gdata\oauth\__init__.py -> build\lib\gdata\oauth
copying src\gdata\opensearch\data.py -> build\lib\gdata\opensearch
copying src\gdata\opensearch\__init__.py -> build\lib\gdata\opensearch
copying src\gdata\photos\service.py -> build\lib\gdata\photos
copying src\gdata\photos\__init__.py -> build\lib\gdata\photos
copying src\gdata\projecthosting\client.py -> build\lib\gdata\projecthosting
copying src\gdata\projecthosting\data.py -> build\lib\gdata\projecthosting
copying src\gdata\projecthosting\__init__.py -> build\lib\gdata\projecthosting
copying src\gdata\sites\client.py -> build\lib\gdata\sites
copying src\gdata\sites\data.py -> build\lib\gdata\sites
copying src\gdata\sites\__init__.py -> build\lib\gdata\sites
copying src\gdata\spreadsheet\service.py -> build\lib\gdata\spreadsheet
copying src\gdata\spreadsheet\text_db.py -> build\lib\gdata\spreadsheet
copying src\gdata\spreadsheet\__init__.py -> build\lib\gdata\spreadsheet
copying src\gdata\spreadsheets\client.py -> build\lib\gdata\spreadsheets
copying src\gdata\spreadsheets\data.py -> build\lib\gdata\spreadsheets
copying src\gdata\spreadsheets\__init__.py -> build\lib\gdata\spreadsheets
copying src\gdata\tlslite\api.py -> build\lib\gdata\tlslite
copying src\gdata\tlslite\BaseDB.py -> build\lib\gdata\tlslite
copying src\gdata\tlslite\Checker.py -> build\lib\gdata\tlslite
copying src\gdata\tlslite\constants.py -> build\lib\gdata\tlslite
copying src\gdata\tlslite\errors.py -> build\lib\gdata\tlslite
copying src\gdata\tlslite\FileObject.py -> build\lib\gdata\tlslite
copying src\gdata\tlslite\HandshakeSettings.py -> build\lib\gdata\tlslite
copying src\gdata\tlslite\mathtls.py -> build\lib\gdata\tlslite
copying src\gdata\tlslite\messages.py -> build\lib\gdata\tlslite
copying src\gdata\tlslite\Session.py -> build\lib\gdata\tlslite
copying src\gdata\tlslite\SessionCache.py -> build\lib\gdata\tlslite
copying src\gdata\tlslite\SharedKeyDB.py -> build\lib\gdata\tlslite
copying src\gdata\tlslite\TLSConnection.py -> build\lib\gdata\tlslite
copying src\gdata\tlslite\TLSRecordLayer.py -> build\lib\gdata\tlslite
copying src\gdata\tlslite\VerifierDB.py -> build\lib\gdata\tlslite
copying src\gdata\tlslite\X509.py -> build\lib\gdata\tlslite
copying src\gdata\tlslite\X509CertChain.py -> build\lib\gdata\tlslite
copying src\gdata\tlslite\__init__.py -> build\lib\gdata\tlslite
copying src\gdata\tlslite\integration\AsyncStateMachine.py -> build\lib\gdata\tl
slite\integration
copying src\gdata\tlslite\integration\ClientHelper.py -> build\lib\gdata\tlslite
\integration
copying src\gdata\tlslite\integration\HTTPTLSConnection.py -> build\lib\gdata\tl
slite\integration
copying src\gdata\tlslite\integration\IMAP4_TLS.py -> build\lib\gdata\tlslite\in
tegration
copying src\gdata\tlslite\integration\IntegrationHelper.py -> build\lib\gdata\tl
slite\integration
copying src\gdata\tlslite\integration\POP3_TLS.py -> build\lib\gdata\tlslite\int
egration
copying src\gdata\tlslite\integration\SMTP_TLS.py -> build\lib\gdata\tlslite\int
egration
copying src\gdata\tlslite\integration\TLSAsyncDispatcherMixIn.py -> build\lib\gd
ata\tlslite\integration
copying src\gdata\tlslite\integration\TLSSocketServerMixIn.py -> build\lib\gdata
\tlslite\integration
copying src\gdata\tlslite\integration\TLSTwistedProtocolWrapper.py -> build\lib\
gdata\tlslite\integration
copying src\gdata\tlslite\integration\XMLRPCTransport.py -> build\lib\gdata\tlsl
ite\integration
copying src\gdata\tlslite\integration\__init__.py -> build\lib\gdata\tlslite\int
egration
copying src\gdata\tlslite\utils\AES.py -> build\lib\gdata\tlslite\utils
copying src\gdata\tlslite\utils\ASN1Parser.py -> build\lib\gdata\tlslite\utils
copying src\gdata\tlslite\utils\cipherfactory.py -> build\lib\gdata\tlslite\util
s
copying src\gdata\tlslite\utils\codec.py -> build\lib\gdata\tlslite\utils
copying src\gdata\tlslite\utils\compat.py -> build\lib\gdata\tlslite\utils
copying src\gdata\tlslite\utils\Cryptlib_AES.py -> build\lib\gdata\tlslite\utils
copying src\gdata\tlslite\utils\Cryptlib_RC4.py -> build\lib\gdata\tlslite\utils
copying src\gdata\tlslite\utils\Cryptlib_TripleDES.py -> build\lib\gdata\tlslite
\utils
copying src\gdata\tlslite\utils\cryptomath.py -> build\lib\gdata\tlslite\utils
copying src\gdata\tlslite\utils\dateFuncs.py -> build\lib\gdata\tlslite\utils
copying src\gdata\tlslite\utils\hmac.py -> build\lib\gdata\tlslite\utils
copying src\gdata\tlslite\utils\jython_compat.py -> build\lib\gdata\tlslite\util
s
copying src\gdata\tlslite\utils\keyfactory.py -> build\lib\gdata\tlslite\utils
copying src\gdata\tlslite\utils\OpenSSL_AES.py -> build\lib\gdata\tlslite\utils
copying src\gdata\tlslite\utils\OpenSSL_RC4.py -> build\lib\gdata\tlslite\utils
copying src\gdata\tlslite\utils\OpenSSL_RSAKey.py -> build\lib\gdata\tlslite\uti
ls
copying src\gdata\tlslite\utils\OpenSSL_TripleDES.py -> build\lib\gdata\tlslite\
utils
copying src\gdata\tlslite\utils\PyCrypto_AES.py -> build\lib\gdata\tlslite\utils
copying src\gdata\tlslite\utils\PyCrypto_RC4.py -> build\lib\gdata\tlslite\utils
copying src\gdata\tlslite\utils\PyCrypto_RSAKey.py -> build\lib\gdata\tlslite\ut
ils
copying src\gdata\tlslite\utils\PyCrypto_TripleDES.py -> build\lib\gdata\tlslite
\utils
copying src\gdata\tlslite\utils\Python_AES.py -> build\lib\gdata\tlslite\utils
copying src\gdata\tlslite\utils\Python_RC4.py -> build\lib\gdata\tlslite\utils
copying src\gdata\tlslite\utils\Python_RSAKey.py -> build\lib\gdata\tlslite\util
s
copying src\gdata\tlslite\utils\RC4.py -> build\lib\gdata\tlslite\utils
copying src\gdata\tlslite\utils\rijndael.py -> build\lib\gdata\tlslite\utils
copying src\gdata\tlslite\utils\RSAKey.py -> build\lib\gdata\tlslite\utils
copying src\gdata\tlslite\utils\TripleDES.py -> build\lib\gdata\tlslite\utils
copying src\gdata\tlslite\utils\xmltools.py -> build\lib\gdata\tlslite\utils
copying src\gdata\tlslite\utils\__init__.py -> build\lib\gdata\tlslite\utils
copying src\gdata\webmastertools\data.py -> build\lib\gdata\webmastertools
copying src\gdata\webmastertools\service.py -> build\lib\gdata\webmastertools
copying src\gdata\webmastertools\__init__.py -> build\lib\gdata\webmastertools
copying src\gdata\youtube\client.py -> build\lib\gdata\youtube
copying src\gdata\youtube\data.py -> build\lib\gdata\youtube
copying src\gdata\youtube\service.py -> build\lib\gdata\youtube
copying src\gdata\youtube\__init__.py -> build\lib\gdata\youtube
running install_lib
running install_egg_info
Removing C:\Python27\Lib\site-packages\gdata-2.0.17-py2.7.egg-info
Writing C:\Python27\Lib\site-packages\gdata-2.0.17-py2.7.egg-info
尝试运行先前链接的示例代码,结果如下:
C:\gdata>python gdata.py
Traceback (most recent call last):
File "gdata.py", line 4, in <module>
import gdata.spreadsheet.service
File "C:\gdata\gdata.py", line 4, in <module>
import gdata.spreadsheet.service
ImportError: No module named spreadsheet.service
但有趣的是,如果我只是python
从命令行运行并点击有问题的行 - import gdata.spreadsheet.service
- 它可以正常工作,这就是为什么我猜测这是一个安装/配置问题而不是代码问题。
如果重要的话,Windows 7 上可以使用 Python 2.7。
答案1
这似乎是一个安装问题这答案是:
python setup.py
使用不支持 install_requires 的 distutils。setuptools 可以,但 distributor (其后继者) 和 pip (基本上使用 setuptool/distribute) 也可以。但您实际上必须使用它们。即通过命令easy_install
或调用 setuptools pip install
。另一种方法是从 setup.py 中的 setuptools 导入 setup,但这不是标准,并且会使每个人都想使用您的包来安装 setuptools。