[英]Error while importing modules in Python
我希望能夠導入以下Google Data Python模塊:atom.data,gdata.sites.client,gdata.sites.data
我已經繼續下載了文件,甚至按照建議在[link]中更改了PYTHONPATH變量( 如何在Windows 7中添加到pythonpath中? )。 盡管如此,我還是收到一條錯誤消息:
導入錯誤沒有名為atom.data的模塊。
我究竟做錯了什么? 我已將GData文件放置在Python27文件夾中。
代碼(僅在情況下):
#!C:\Python27
import atom.data
import gdata.sites.client
import gdata.sites.data
client = gdata.sites.client.SitesClient(source='i-l-v1', site='intratrial2', domain='inmobi.com')
client.ClientLogin('', '', client.source)
feed = client.GetSiteFeed()
for entry in feed.entry:
print '%s (%s)' % (entry.title.text, entry.site_name.text)
if entry.summary.text:
print 'description: ' + entry.summary.text
if entry.FindSourceLink():
print 'this site was copied from site: ' + entry.FindSourceLink()
print 'acl feed: %s\n' % entry.FindAclLink()
print 'theme: ' + entry.theme.text
在Linux上,我在虛擬環境中進行了“ pip install gdata”,然后創建了指向gdata的符號鏈接。 那對我有用。
$source venv/bin/activate
$pip install gdata
$deactivate
$ln -s venv/lib/python2.7/site-packages/gdata .
您是否嘗試使用./setup.py install安裝它。 它會做所有必要的事情,而您不必從自己的角度設置任何路徑。 有關更多詳細信息,請參閱https://developers.google.com/gdata/articles/python_client_lib?csw=1 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.