如何在树莓派上安装python 3和setuptools?

我想安装you-get,但失败了.首先,当我根据项目的自述文件运行make install时,出现以下错误:

pi@raspberrypi ~/you-get $make install
python3 setup.py bdist_egg
Traceback (most recent call last):
  File "setup.py", line 15, in <module>
    from setuptools import setup, find_packages
ImportError: No module named setuptools
make: *** [bdist_egg] Error 1

我猜是因为没有安装python的setuptool,所以根据this,我运行了命令,但是仍然出现上述错误.

然后我尝试了sudo easy_install pip和pip install you-get,但收到此错误:

pi@raspberrypi ~ $sudo pip install you-get
Downloading/unpacking you-get
  Downloading you-get-0.3.24.tar.gz (51kB): 51kB downloaded
  Running setup.py egg_info for package you-get

Installing collected packages: you-get
  Running setup.py install for you-get

    SyntaxError: ("unqualified exec is not allowed in function 'decipher' it contains a nested function with free variables",)

Successfully installed you-get
Cleaning up...

我想看看它是否真的失败了,所以我运行-get -V,然后得到这个错误:

pi@raspberrypi ~ $you-get -V
Traceback (most recent call last):
  File "/usr/local/bin/you-get", line 8, in <module>
    load_entry_point('you-get==0.3.24', 'console_scripts', 'you-get')()
  File "build/bdist.linux-armv6l/egg/pkg_resources.py", line 318, in load_entry_point
  File "build/bdist.linux-armv6l/egg/pkg_resources.py", line 2221, in load_entry_point
  File "build/bdist.linux-armv6l/egg/pkg_resources.py", line 1954, in load
  File "/usr/local/lib/python2.7/dist-packages/you_get/__init__.py", line 3, in <module>
    from .common import *
  File "/usr/local/lib/python2.7/dist-packages/you_get/common.py", line 9, in <module>
    from urllib import request, parse
ImportError: cannot import name request

我猜这是因为python的版本,在Raspberry Pi上,默认的python版本是2.7,但是您获取的软件需要python 3,所以我安装了python3并运行此命令:

pi@raspberrypi ~ $python3 /usr/bin/you-get
python3: can't open file '/usr/bin/you-get': [Errno 2] No such file or directory

pi@raspberrypi ~ $whereis you-get
you-get: /usr/local/bin/you-get

pi@raspberrypi ~ $python3 /usr/local/bin/you-get
Traceback (most recent call last):
  File "/usr/local/bin/you-get", line 5, in <module>
    from pkg_resources import load_entry_point
ImportError: No module named pkg_resources

那我不知道下一步该怎么做.

解决方法:

如果您想安装Python 3.X版本的pip,则需要将合适的目标定位到良好的软件包:

sudo apt-get install python3-pip

有关更多信息http://packages.debian.org/wheezy/python3-pip

上一篇:PHP-YouTube iframe API触发所有事件两次


下一篇:适用于Android的YouTube播放器在广告播放时崩溃