导入错误:没有名为'twitter'的模块
我正在尝试在Windows 7上安装一个外部包,名字叫twitter 1.14.3。
我把这个包下载到了c:\python33\twitter-1.14.3这个文件夹里。
然后我运行了:
python.exe c:\python33\twitter-1.14.3\setup.py install
Finished processing..
现在我想使用这个新模块:
from twitter import *
但是我遇到了一个错误:
Traceback (most recent call last):
File "test1.py", line 1, in <module>
\ufefffrom twitter import *
ImportError: No module named 'twitter'
当我尝试运行twitter.exe时,我得到了:
c:\Python33\Scripts>twitter.exe
Traceback (most recent call last):
File "c:\Python33\Scripts\twitter-script.py", line 9, in <module>
load_entry_point('twitter==1.14.3', 'console_scripts', 'twitter')()
File "c:\Python33\lib\site-packages\setuptools-5.4.1-py3.3.egg\pkg_resources.py", line 356, in load_entry_point
File "c:\Python33\lib\site-packages\setuptools-5.4.1-py3.3.egg\pkg_resources.py", line 2476, in load_entry_point
File "c:\Python33\lib\site-packages\setuptools-5.4.1-py3.3.egg\pkg_resources.py", line 2190, in load
ImportError: No module named 'twitter'
有没有什么建议?
谢谢!
1 个回答
0
打开你电脑上的命令提示符,输入以下内容:
pip install twitter
如果一切顺利,它会显示类似“正在安装收集的包... 成功安装 twitter-1.18.0”的信息。
接下来,在你的开发环境中运行:
import twitter # work with Twitter APIs
然后继续设置你的API密钥。