无法在 Python 3.2 (Raspberry Pi) 上安装 twython

Can't install twython on Python 3.2 (Raspberry Pi)

提问人:Hack-R 提问时间:6/4/2017 最后编辑:OneCricketeerHack-R 更新时间:6/7/2017 访问量:717

问:

我正在尝试安装twython,但不断出现错误。

第一次尝试:

pi@raspberrypi ~/twython $ sudo pip-3.2 install twython
 Running setup.py egg_info for package requests
    Traceback (most recent call last):
      File "<string>", line 14, in <module>
      File "/home/pi/twython/build/requests/setup.py", line 52, in <module>
        exec(f.read(), about)
      File "<string>", line 14
        __cake__ = u'\u2728 \U0001f370 \u2728'
                                             ^
    SyntaxError: invalid syntax
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 14, in <module>

  File "/home/pi/twython/build/requests/setup.py", line 52, in <module>

    exec(f.read(), about)

  File "<string>", line 14

    __cake__ = u'\u2728 \U0001f370 \u2728'

                                         ^

SyntaxError: invalid syntax

----------------------------------------
Command python setup.py egg_info failed with error code 1 in /home/pi/twython/build/requests

接下来,我搜索了错误的最后一行,并遵循了一些建议,这些建议说要确保并已安装并保持最新状态,但这无济于事。setuptoolsez_install

然后我按照 ReadtheDocs 上的备份说明进行操作,该说明说尝试以这种方式安装它:

git clone git://github.com/ryanmcgrath/twython.git
cd twython
sudo python3 setup.py install

但它又失败了:

  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 640, in install_item
    self.process_distribution(spec, dist, deps)
  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 692, in process_distribution
    [requirement], self.local_index, self.easy_install
  File "/usr/lib/python3/dist-packages/pkg_resources.py", line 576, in resolve
    dist = best[req.key] = env.best_match(req, self, installer)
  File "/usr/lib/python3/dist-packages/pkg_resources.py", line 822, in best_match
    return self.obtain(req, installer) # try and download/install
  File "/usr/lib/python3/dist-packages/pkg_resources.py", line 834, in obtain
    return installer(requirement)
  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 608, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 638, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 828, in install_eggs
    return self.build_and_install(setup_script, setup_base)
  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1105, in build_and_install
    self.run_setup(setup_script, setup_base, args)
  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1094, in run_setup
    run_setup(setup_script, args)
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 31, in run_setup
    lambda: exec(compile(open(
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 73, in run
    return func()
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 34, in <lambda>
    {'__file__':setup_script, '__name__':'__main__'})
  File "setup.py", line 52, in <module>

Error in atexit._run_exitfuncs:
TypeError: 'NoneType' object is not callable
python-3.x 模块 twython

评论

1赞 OneCricketeer 6/4/2017
顺便说一句,这些文档页面都没有使用 sudo(这对于这个错误并不重要)
0赞 Hack-R 6/4/2017
@cricket_007我知道,但如果你不使用 sudo,你只会收到一条消息,说你没有权限。感谢您修复错误代码格式。
0赞 Hack-R 6/4/2017
更新:我也在 GitHub 和 Twitter 上联系,试图获得一些支持,如果这些渠道有任何帮助,我会相应地更新这篇文章
0赞 teknoboy 6/7/2017
您是否安装在内部?virtualenv

答:

1赞 Hack-R 6/7/2017 #1

事实证明,Twython 不能与 Python v3.2 一起使用,因为它依赖于 Python 3.2 中显然不支持的模块。requests

Twython 的一位开发人员刚刚在 Twitter 上向我解释了这一点。