Python-Import-tweepy-ImportError:没有名为tweepy的模块

Python-Import-tweepy-ImportError:没有名为tweepy的模块,python,tweepy,Python,Tweepy,我安装了pip-install-tweepy,安装时没有错误 Requirement already satisfied: tweepy in /Library/Python/2.7/site-packages Requirement already satisfied: requests>=2.11.1 in /Library/Python/2.7/site-packages (from tweepy) Requirement already satisfied: PySocks>

我安装了pip-install-tweepy,安装时没有错误

Requirement already satisfied: tweepy in /Library/Python/2.7/site-packages
Requirement already satisfied: requests>=2.11.1 in /Library/Python/2.7/site-packages (from tweepy)
Requirement already satisfied: PySocks>=1.5.7 in /Library/Python/2.7/site-packages (from tweepy)
Requirement already satisfied: six>=1.10.0 in /Library/Python/2.7/site-packages (from tweepy)
Requirement already satisfied: requests-oauthlib>=0.7.0 in /Library/Python/2.7/site-packages (from tweepy)
Requirement already satisfied: certifi>=2017.4.17 in /Library/Python/2.7/site-packages (from requests>=2.11.1->tweepy)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /Library/Python/2.7/site-packages (from requests>=2.11.1->tweepy)
Requirement already satisfied: idna<2.7,>=2.5 in /Library/Python/2.7/site-packages (from requests>=2.11.1->tweepy)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in /Library/Python/2.7/site-packages (from requests>=2.11.1->tweepy)
Requirement already satisfied: oauthlib>=0.6.2 in /Library/Python/2.7/site-packages (from requests-oauthlib>=0.7.0->tweepy)
作为应用程序,我使用Pycharm,我的操作系统是OSX

Python 3——版本:Python 3.6.4

当我运行代码时,出现以下错误:

进口粗花呢

ImportError:没有名为tweepy的模块


尝试通过以下命令安装:

python3 -m pip install tweepy
在PyCharm中,设置->项目解释器->+->tweepy->安装 包裹

通过以上所述,特威比已经在PyCharm终端工作


另一方面,我通过键入python3-m pip install tweepy安装了tweepy

如果您使用的是ubuntu,请尝试:
sudo-apt-install-python-pip

然后运行:
python3-m pip安装tweepy


我希望这有帮助

我将它直接安装在Python文件夹中,但它对我不起作用

之后,我在同一个提示符下使用:
pip uninstall tweepy
卸载了

因此,我使用了Anaconda提示符,在代码之后:
pip-install-tweepy
它对我有效


我希望这是有用的。

这通常发生在您可能在pycharm中使用不同python环境的地方。在多次安装pip时,您的计算机可能会有不同的python解释器。 尝试使用以下步骤配置确切的python解释器。 PyCharm,设置->项目解释器-> 这将在右上方显示已安装的软件包列表和专用解释器。在下拉列表中尝试正确的解释器。 对于Ubuntu 20.04

   pip3 install --user tweepy

您已经为Python 2.7安装了tweepy。您使用什么Python版本来运行代码?也许您实际上使用的是Python 3?当我签入PyCharm时,作为项目解释器,它使用的是Python 2.7。我不使用Python3来确保您没有运行Python3,请尝试一个在Python3下会失败的简单脚本,例如
print'hello'
。这可能很有用:这个脚本有效。当我在终端上运行我的代码时,它可以工作,但当我在PyCharm应用程序中运行时,我仍然得到相同的错误,您可能正在PyCharm中使用不同的环境。不知道你在哪里安装的。谢谢你的评论。下次我会改进我的答案
   pip3 install --user tweepy