2017-06-03 78 views
1

我試圖安裝twython,但不斷收到錯誤。不能在Python 3.2(樹莓派)上安裝twython

第一次嘗試:

[email protected] ~/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 
+0

順便提一下,這些文檔頁面都沒有使用sudo(不是那個對於這個錯誤很重要) –

+0

@ cricket_007我知道,但是如果你不使用sudo,你只會得到一條你沒有權限的消息。感謝您修復錯誤代碼格式。 –

+0

更新:我也在GitHub和Twitter上試圖獲得一些支持,並且如果有任何來自這些頻道的幫助 –

回答

1

事實證明,Twython不能與Python工作因爲它取決於requests模塊,這在Python 3.2中顯然不受支持。

Twython的開發人員之一在Twitter上向我解釋了這一點。