Python 如何通过 pip 安装 tweepy 包?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/39710454/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 22:36:38  来源:igfitidea点击:

How can I install a tweepy package via pip?

pythonpippackage-managers

提问by coopchange

Can't get pip to work; trying to install Tweepy per this article.

无法让 pip 工作;尝试按照本文安装 Tweepy 。

This threadmanaged to solve it for someone installing a different package, but I've tried all the strategies listed there including changing PATH in my environment variables, and I get "syntax error" for each of these three attempts:

这个线程设法为安装不同软件包的人解决了这个问题,但我已经尝试了那里列出的所有策略,包括在我的环境变量中更改 PATH,并且对于这三种尝试中的每一种,我都会收到“语法错误”:

pip install tweepy

python -m pip install tweepy

C:\Python27\Scripts\pip.exe install tweepy

回答by ryux

Are you using pip install command inside of the python prompt? If yes then you need to type it directly into command prompt.Open command prompt and type.

您是否在 python 提示符内使用 pip install 命令?如果是,那么您需要直接在命令提示符中键入它。打开命令提示符并键入。

pip install tweepy

回答by Stuti Varshney

Just try adding sudo before the command, should look like this sudo pip install tweepy

尝试在命令前添加 sudo ,应该看起来像这样 sudo pip install tweepy

回答by Mir Rahed Uddin

For python3 use pip3 install tweepycommand from your terminal

对于 python3,使用pip3 install tweepy终端中的命令

回答by CodeZeus

C:\>pip install tweepy

C:\>pip install tweepy

The first command is enough provided that pip has been added to the Path environment variable of your system. To check it out, do this:

只要 pip 已添加到系统的 Path 环境变量中,第一个命令就足够了。要检查它,请执行以下操作:

  1. Open Command Prompt (DOS prompt).
  2. Type pythonand press enter.
  3. Once python prompt (>>>) appears, type import pipand press enter.
  1. 打开命令提示符(DOS 提示符)。
  2. 键入蟒蛇,然后按回车。
  3. 出现 python 提示 (>>>) 后,输入import pip并按 Enter。

If you see an error, then pip has not been added to the environment variable Path. If there's no error whatsoever, then pip is installed properly.

如果您看到错误,则 pip 尚未添加到环境变量 Path 中。如果没有任何错误,则 pip 安装正确。

In that case, re-install Python once and try again. I am using Python 3.5 and tweepy works fine for me. I see that you are using Python 2.7 version. I hope Python has been properly installed. If you want, try uninstalling Python and then re-installing it properly just to make sure. I will also suggest you to try using Python 3.x version once to see if you get the same error.

在这种情况下,重新安装 Python 并重试。我正在使用 Python 3.5,tweepy 对我来说很好用。我看到您使用的是 Python 2.7 版本。我希望 Python 已正确安装。如果需要,请尝试卸载 Python,然后正确地重新安装它以确保安全。我还建议您尝试使用 Python 3.x 版本一次,看看您是否遇到相同的错误。

Hope it helps.

希望能帮助到你。