导入错误:没有名为“twitter”的模块

问题描述 投票:0回答:1

我尝试安装外部包的第一个文件 - twitter 1.14.3(在 Windows 7 上)

所以我将包下载到c:\python33 witter-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'

有什么想法吗?

谢谢/

python python-3.x twitter
1个回答
0
投票

导航到您友好的邻居命令提示符并输入以下内容:

pip install twitter

它应该显示类似“正在安装收集的软件包...成功安装 twitter-1.18.0”

然后从您的 IDE 运行:

import twitter  # work with Twitter APIs

并继续设置您的 API 密钥

© www.soinside.com 2019 - 2024. All rights reserved.