简体   繁体   English

Python 3安装tweepy

[英]Python 3 installing tweepy

I have looked at all the forums, but nothing has worked so far. 我看过所有论坛,但到目前为止没有任何进展。 I have spent hours trying to install it so any help would be appreciated. 我已经花了数小时尝试安装它,因此不胜感激。 i have downloaded and unzipped tweepy, went on to the command prompt, typed "cd tweepy-master". 我已经下载并解压缩了tweepy,然后转到命令提示符,键入“ cd tweepy-master”。 This works, but when i type "python setup.py install" or "python setup.py build". 这有效,但是当我键入“ python setup.py install”或“ python setup.py build”时。

When i type "python setup.py install" the error says. 当我输入“ python setup.py install”时,错误提示。

Traceback (most recent call last):
  File "setup.py", line 4, in <module>
    from setuptools import setup, find_packages
  File "C:\Users\Sam Terrett\Documents\Portable Python 3.2.5.1\App\lib\site-packages\setuptools\__init__.py", line 2, in <module>
    from setuptools.extension import Extension, Library
  File "C:\Users\Sam Terrett\Documents\Portable Python 3.2.5.1\App\lib\site-packages\setuptools\extension.py", line 5, in <module>
    from setuptools.dist import _get_unpatched
  File "C:\Users\Sam Terrett\Documents\Portable Python 3.2.5.1\App\lib\site-packages\setuptools\dist.py", line 103
    except ValueError, e:
                     ^
SyntaxError: invalid syntax

When i type "python setup.py build" 当我输入“ python setup.py build”时

Traceback (most recent call last):
  File "setup.py", line 4, in <module>
    from setuptools import setup, find_packages
  File "C:\Users\Sam Terrett\Documents\Portable Python 3.2.5.1\App\lib\site-packages\setuptools\__init__.py", line 2, in <module>
    from setuptools.extension import Extension, Library
  File "C:\Users\Sam Terrett\Documents\Portable Python 3.2.5.1\App\lib\site-packages\setuptools\extension.py", line 5, in <module>
    from setuptools.dist import _get_unpatched
  File "C:\Users\Sam Terrett\Documents\Portable Python 3.2.5.1\App\lib\site-packages\setuptools\dist.py", line 103
    except ValueError, e:
                     ^
SyntaxError: invalid syntax

I saw alot of people saying to use pip, but i am struggling to install that to. 我看到很多人说要使用pip,但我正在努力将其安装到pip。 Thanks for the help 谢谢您的帮助

pip is the good way to install a package. pip是安装软件包的好方法。 If you are not interested then you can install from source. 如果您不感兴趣,则可以从源代码安装。

But you have to remember that, If you are using virtualenv or virtualenvwrapper then you can use python setup.py install otherwise you should use sudo python setup.py install . 但您必须记住,如果使用virtualenvvirtualenvwrapper则可以使用python setup.py install否则应使用sudo python setup.py install

If you are windows user then, open your cmd with administator privilege and type python setup.py install . 如果您是Windows用户,请使用管理员权限打开cmd ,然后输入python setup.py install

Have you installed Python using the Windows installer from python.org ? 您是否已使用python.org中的Windows安装程序安装了Python?

Cause this comes with pip already bundled into it. 因为这是已经捆绑了点子的。 (I can not check the exact location atm, as I am on a Mac, but according to this SO post it should be located under C:\\PythonX.X\\Scripts , if you kept the default install location - otherwise it should be located in <path-to-python>\\Scripts of course). (我无法像在Mac上那样检查atm的确切位置,但是根据此SO帖子,如果保留了默认安装位置,则应位于C:\\PythonX.X\\Scripts下-否则应位于在<path-to-python>\\Scripts中)。

Otherwise pip can easily installed using this script. 否则,可以使用脚本轻松安装pip。 Simply call python get-pip.py in the script location and pip should be available afterwards (if not directly from commandline with pip , than at least by using python -m pip .) Having pip finally available, you should be able to easily install tweepy calling pip install tweepy (or python -m pip install tweepy respectively). 只需在脚本位置调用python get-pip.py ,之后pip应该即可使用(如果不是直接python get-pip.py使用pip ,则至少应使用python -m pip 。)最终使pip可用时,您应该可以轻松安装tweepy调用pip install tweepy (或者分别是python -m pip install tweepy )。

For further information on pip and the other options to install it, check https://pip.pypa.io/en/stable/installing/ . 有关pip和其他安装选项的更多信息,请检查https://pip.pypa.io/en/stable/installing/

PS. PS。 If installing the package via pip does not work, this may be a compatibility issue. 如果无法通过pip安装软件包,则可能是兼容性问题。 According to the tweepy github-page python 3.2 is not amongst the supported python versions. 根据tweepy的github-page, python 3.2 不在受支持的python版本中。 So if your portable python really has an interpreter versioned 3.2.... (you can check the version of your interpreter running python from cmd, which should print something like > Python 3.XX ), the package may not run properly at all (even if you can install it without a problem). 因此,如果您的便携式python确实有一个解释器版本为3.2 ....(您可以从cmd检查运行python的解释器的版本,应显示类似> Python 3.XX ),则该软件包可能根本无法正常运行(即使您可以毫无问题地安装它)。

As the portable python apparently is no longer supported anyways, it may be worth trying a different solution. 由于显然不再支持可移植的python,因此值得尝试使用其他解决方案。 There are plenty suggested on the portable python website (I just know about Anaconda, but this works flawlessly). 便携式python网站上有很多建议(我只是对Anaconda有所了解,但这完美无缺)。 But if you only want to use python with tweepy and don't need anything like scipy or numpy, I'd suggest simply downloading the installer from the official website. 但是,如果您只想在tweepy中使用python,并且不需要scipy或numpy之类的东西,我建议您只是从官方网站下载安装程序。 As said, pip gets shipped with the standard installation and can be used to easily install most of the packages you will need. 如前所述,pip随标准安装一起提供,可用于轻松安装所需的大多数软件包。 (Except for eg the abovementioned scipy/numpy, which require additional non-python libraries whose "manual" installation may not be worth the trouble and hence legitimates the use of a more comprehensive environment like Anaconda). (例如上述scipy / numpy除外,它需要其他的非Python库,其“手动”安装可能不值得麻烦,因此可以合法地使用像Anaconda这样的更全面的环境)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM