【问题标题】:How to install python 3 and setuptools on raspberry pi?如何在树莓派上安装 python 3 和 setuptools?
【发布时间】:2014-01-02 16:48:43
【问题描述】:

我想安装you-get 但失败了。首先,当我根据项目的 README 文件运行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 pippip 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...

我想看看是不是真的失败了,所以我运行you-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的版本,在树莓派上默认的python版本是2.7,但是you-get软件需要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 python-2.7 python-3.x youtube raspberry-pi


【解决方案1】:

我已经有 python3 但没有 setuptools,这很有效:

sudo apt-get install python3-setuptools

Raspbian Jessie Pi3B

【讨论】:

    【解决方案2】:
    sudo apt-get install python3-pip
    

    或者对于 python 2:

    sudo apt-get install python-pip
    

    【讨论】:

      【解决方案3】:

      如果你想安装 Python 3.X 版本的 pip,你需要将 aptitude 定位到好包:

      sudo apt-get install python3-pip
      

      欲了解更多信息http://packages.debian.org/wheezy/python3-pip

      【讨论】:

      • 这个我试过了,真的不行,python3-pip这个软件好像不存在。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-12-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多