import twitter
api = twitter.Api(consumer_key=' ',
consumer_secret=' ',
access_token_key=' ',
access_token_secret=' ')
friends=api.PostUpdate("First Tweet from PYTHON APP ")
我已经尽了一切所说的http://abhi74k.wordpress.com/2010/12/21/tweeting-from-python/但是当我充满它并按下回车键时,什么也没有发生。你能帮我解答吗?为什么我无法从Python发送推文?
好吧,因为我无法正确下载python-twitter API。它给了我这个错误,当我尝试按照这些步骤:
[email protected]:~/Downloads/python-twitter-0.8.2$ python setup.py install
running install
running build
running build_py
running install_lib
copying build/lib.linux-x86_64-2.7/twitter.py -> /usr/local/lib/python2.7/dist-packages
error: /usr/local/lib/python2.7/dist-packages/twitter.py: Permission denied
http://code.google.com/p/python-twitter/
好吧,我安装了setup.py
但现在它给出了这样的错误:
[email protected]:~/Downloads/python-twitter-0.8.2$ python twitter_test.py
Traceback (most recent call last):
File "twitter_test.py", line 29, in <module>
import twitter
File "/home/figen/Downloads/python-twitter-0.8.2/twitter.py", line 65, in <module>
import oauth2 as oauth
ImportError: No module named oauth2
现在它说,Twitter的模块没有按”没有模块。如何得到它?
api = twitter.Api(consumer_key='removed',
consumer_secret='removed',
access_token_key='removed',
access_token_secret='removed')
friends=api.PostUpdate("If you see this,I managed to send my first tweet from Python Shell. Yay! =)")
Traceback (most recent call last):
File "<pyshell#5>", line 1, in <module>
api = twitter.Api(consumer_key='removed for security=)',
AttributeError: 'module' object has no attribute 'Api'
好吧,这可能是一个愚蠢的问题,但这不是你试图运行的实际代码?你在试用时是否填写了钥匙? – teukkam 2012-03-06 13:22:53
是的,我填满了他们。我更新了问题。你能再看一遍吗? – 2012-03-06 13:31:46
尝试'sudo python setup.py install' – Peter 2012-03-06 13:33:20