如何使用Anacondas和easy_install安装Tweepy

时间:2014-07-20 09:01:10

标签: tweepy anaconda

我在使用Anacondas Python 3.3安装Tweepy时遇到问题。

首先,我访问了Python 3.3安装的scripts目录。然后我跑了

easy_install tweepy

如果我在我的默认Python Scripts目录中运行它,它可以工作,但这是一个我不想使用的旧Python版本。

我的输出如下。它说了一些关于导入报价的内容。

C:\Anaconda\envs\py33\Scripts>easy_install tweepy
Searching for tweepy
Reading http://pypi.python.org/simple/tweepy/
Best match: tweepy 2.3.0
Downloading https://pypi.python.org/packages/source/t/tweepy/tweepy-2.3.0.tar.gz#md5=065c80d244360988c61d64b5dfb7e229
Processing tweepy-2.3.0.tar.gz
Writing c:\users\jon\appdata\local\temp\easy_install-tmda2q\tweepy-2.3.0\setup.cfg
Running tweepy-2.3.0\setup.py -q bdist_egg --dist-dir c:\users\jon\appdata\local\temp\easy_install-tmda2q\tweepy-2.3.0\egg-dist-tmp-006ghp
Traceback (most recent call last):
  File "C:\Anaconda\envs\py33\Scripts\easy_install-script.py", line 5, in <module>
    sys.exit(main())
  File "C:\Anaconda\envs\py33\lib\site-packages\setuptools\command\easy_install.py", line 1986, in main
    with_ei_usage(lambda:
  File "C:\Anaconda\envs\py33\lib\site-packages\setuptools\command\easy_install.py", line 1967, in with_ei_usage
    return f()
  File "C:\Anaconda\envs\py33\lib\site-packages\setuptools\command\easy_install.py", line 1990, in <lambda>
    distclass=DistributionWithoutHelpCommands, **kw
  File "C:\Anaconda\envs\py33\lib\distutils\core.py", line 148, in setup
    dist.run_commands()
  File "C:\Anaconda\envs\py33\lib\distutils\dist.py", line 930, in run_commands
    self.run_command(cmd)
  File "C:\Anaconda\envs\py33\lib\distutils\dist.py", line 949, in run_command
    cmd_obj.run()
  File "C:\Anaconda\envs\py33\lib\site-packages\setuptools\command\easy_install.py", line 360, in run
    self.easy_install(spec, not self.no_deps)
  File "C:\Anaconda\envs\py33\lib\site-packages\setuptools\command\easy_install.py", line 604, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File "C:\Anaconda\envs\py33\lib\site-packages\setuptools\command\easy_install.py", line 634, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File "C:\Anaconda\envs\py33\lib\site-packages\setuptools\command\easy_install.py", line 829, in install_eggs
    return self.build_and_install(setup_script, setup_base)
  File "C:\Anaconda\envs\py33\lib\site-packages\setuptools\command\easy_install.py", line 1109, in build_and_install
    self.run_setup(setup_script, setup_base, args)
  File "C:\Anaconda\envs\py33\lib\site-packages\setuptools\command\easy_install.py", line 1095, in run_setup
    run_setup(setup_script, args)
  File "C:\Anaconda\envs\py33\lib\site-packages\setuptools\sandbox.py", line 34, in run_setup
    lambda: exec(compile(open(
  File "C:\Anaconda\envs\py33\lib\site-packages\setuptools\sandbox.py", line 82, in run
    return func()
  File "C:\Anaconda\envs\py33\lib\site-packages\setuptools\sandbox.py", line 37, in <lambda>
    {'__file__':setup_script, '__name__':'__main__'})
  File "setup.py", line 4, in <module>
  File "c:\users\jon\appdata\local\temp\easy_install-tmda2q\tweepy-2.3.0\tweepy\__init__.py", line 12, in <module>
  File "c:\users\jon\appdata\local\temp\easy_install-tmda2q\tweepy-2.3.0\tweepy\models.py", line 6, in <module>
  File "c:\users\jon\appdata\local\temp\easy_install-tmda2q\tweepy-2.3.0\tweepy\utils.py", line 9, in <module>
ImportError: cannot import name quote

6 个答案:

答案 0 :(得分:4)

基于https://github.com/tweepy/tweepy/issues/199,tweepy不支持Python 3.所以你需要使用Python 2.因为你使用的是Anaconda,你可以为Python 2创建一个conda环境

conda create -n py2 python=2 anaconda
activate  py2
pip install tweepy

或者,您可以尝试使用不同的Python Twitter库,例如https://pypi.python.org/pypi/twitter

答案 1 :(得分:4)

2017年答案。
根据{{​​3}}

  

安装最新版本的最简单方法是使用pip / easy_install从PyPI中提取它:

     

pip install tweepy

     

您也可以使用Git从Github克隆存储库并手动安装:

git clone https://github.com/tweepy/tweepy.git  
cd tweepy  
python setup.py install
     

Python 2.6和2.7,3.3,3.4&amp;支持3.5。

虽然这不是针对conda的答案,但tweepy github表示如果在其网站上找不到项目,则建议使用其他安装程序,如pip。事实上,documentation上的Anaconda.org页面列出了作为安装程序的pip Python 3+应该带有pip。否则你可以克隆/安装。

答案 2 :(得分:3)

因为你正在使用Anaconda for python。 https://anaconda.org/conda-forge/tweepy

从终端安装tweepy,如下所示:

conda install -c conda-forge tweepy

-c表示channel = conda-forge

答案 3 :(得分:0)

现在您可以使用conda安装tweepy,如下所示:

conda install -c hargup/label/pypi tweepy

Reference anaconda docs

答案 4 :(得分:0)

尝试此命令:

python3。[版本] -m pip install [package-name]

- 在你的情况下使用这个

python3.3 -m pip install tweepy

答案 5 :(得分:0)

像这样从终端安装 tweepy:

conda install -c conda-forge tweepy