2

我一直在尝试在我的 Raspberry Pi Zero 上安装包“flask-ask”。但是,尝试安装依赖项“cryptography”时出现问题:

Downloading/unpacking cryptography
  Downloading cryptography-2.2.2.tar.gz (443kB): 443kB downloaded
  Running setup.py (path:/tmp/pip-build-wg353po4/cryptography/setup.py) egg_info for package cryptography
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/tmp/pip-build-wg353po4/cryptography/setup.py", line 28, in <module>
        "cryptography requires setuptools 18.5 or newer, please upgrade to a "
    RuntimeError: cryptography requires setuptools 18.5 or newer, please upgrade to a newer version of setuptools
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

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

  File "/tmp/pip-build-wg353po4/cryptography/setup.py", line 28, in <module>

    "cryptography requires setuptools 18.5 or newer, please upgrade to a "

RuntimeError: cryptography requires setuptools 18.5 or newer, please upgrade to a newer version of setuptools

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip-build-wg353po4/cryptography
Storing debug log for failure in /home/pi/.pip/pip.log

(这些日志来自尝试自行安装密码学,但在安装烧瓶询问时出现相同的错误)

我已经尝试pip3 install -U setuptools升级它,但这不起作用:

pi@raspberrypi:~ $ pip3 install -U setuptools
Downloading/unpacking setuptools from https://files.pythonhosted.org/packages/7f/e1/820d941153923aac1d49d7fc37e17b6e73bfbd2904959fffbad77900cf92/setuptools-39.2.0-py2.py3-none-any.whl#sha256=8fca9275c89964f13da985c3656cb00ba029d7f3916b37990927ffdf264e7926
  Downloading setuptools-39.2.0-py2.py3-none-any.whl (567kB): 567kB downloaded
Installing collected packages: setuptools
  Found existing installation: setuptools 5.5.1
    Not uninstalling setuptools at /usr/lib/python3/dist-packages, owned by OS
  Can't roll back setuptools; was not uninstalled
Cleaning up...
Exception:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 295, in run
    requirement_set.install(install_options, global_options, root=options.root_path)
  File "/usr/lib/python3/dist-packages/pip/req.py", line 1436, in install
    requirement.install(install_options, global_options, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/pip/req.py", line 672, in install
    self.move_wheel_files(self.source_dir, root=root)
  File "/usr/lib/python3/dist-packages/pip/req.py", line 902, in move_wheel_files
    pycompile=self.pycompile,
  File "/usr/lib/python3/dist-packages/pip/wheel.py", line 214, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/usr/lib/python3/dist-packages/pip/wheel.py", line 208, in clobber
    shutil.copy2(srcfile, destfile)
  File "/usr/lib/python3.4/shutil.py", line 244, in copy2
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/usr/lib/python3.4/shutil.py", line 108, in copyfile
    with open(dst, 'wb') as fdst:
PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.4/dist-packages/easy_install.py'

Storing debug log for failure in /home/pi/.pip/pip.log

所以我该怎么做?我已经对各种不同的事情进行了很多谷歌搜索,并且我看到其他人在 Pi 上遇到密码学问题,但不是这个特定问题。

编辑:好的,所以我现在已经完成pip install --user -U setuptools了,而且效果很好。现在我得到了一个完全不同的错误:

    running install_egg_info
    running egg_info
    creating lib/PyYAML.egg-info
    writing lib/PyYAML.egg-info/PKG-INFO
    writing top-level names to lib/PyYAML.egg-info/top_level.txt
    writing dependency_links to lib/PyYAML.egg-info/dependency_links.txt
    writing manifest file 'lib/PyYAML.egg-info/SOURCES.txt'
    reading manifest file 'lib/PyYAML.egg-info/SOURCES.txt'
    writing manifest file 'lib/PyYAML.egg-info/SOURCES.txt'
    Copying lib/PyYAML.egg-info to /home/pi/.local/lib/python2.7/site-packages/PyYAML-3.12$
    running install_scripts
    writing list of installed files to '/tmp/pip-XYXo6X-record/install-record.txt'
  Could not find .egg-info directory in install record for PyYAML==3.12 (from flask-ask)
  Running setup.py install for cryptography
    Running command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-bui$
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    c/_cffi_backend.c:2:20: fatal error: Python.h: No such file or directory
     #include <Python.h>
                        ^
    compilation terminated.
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-2gl72v/cryptography/setup.py", line 319, in <module>
        **keywords_with_side_effects(sys.argv)
      File "/home/pi/.local/lib/python2.7/site-packages/setuptools/__init__.py", line 128,$
        _install_setup_requires(attrs)
      File "/home/pi/.local/lib/python2.7/site-packages/setuptools/__init__.py", line 123,$
        dist.fetch_build_eggs(dist.setup_requires)
      File "/home/pi/.local/lib/python2.7/site-packages/setuptools/dist.py", line 514, in $
        replace_conflicting=True,
      File "/home/pi/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 7$
        replace_conflicting=replace_conflicting
      File "/home/pi/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1$
        return self.obtain(req, installer)
      File "/home/pi/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1$
        return installer(requirement)
      File "/home/pi/.local/lib/python2.7/site-packages/setuptools/dist.py", line 581, in $
        return cmd.easy_install(req)
      File "/home/pi/.local/lib/python2.7/site-packages/setuptools/command/easy_install.py$
        return self.install_item(spec, dist.location, tmpdir, deps)
      File "/home/pi/.local/lib/python2.7/site-packages/setuptools/command/easy_install.py$
        dists = self.install_eggs(spec, download, tmpdir)
      File "/home/pi/.local/lib/python2.7/site-packages/setuptools/command/easy_install.py$
        return self.build_and_install(setup_script, setup_base)
      File "/home/pi/.local/lib/python2.7/site-packages/setuptools/command/easy_install.py$
        self.run_setup(setup_script, setup_base, args)
      File "/home/pi/.local/lib/python2.7/site-packages/setuptools/command/easy_install.py$
        raise DistutilsError("Setup script exited with %s" % (v.args[0],))
    distutils.errors.DistutilsError: Setup script exited with error: command 'arm-linux-gn$

    Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__=$
    Package libffi was not found in the pkg-config search path.

Perhaps you should add the directory containing `libffi.pc'

to the PKG_CONFIG_PATH environment variable

No package 'libffi' found

Package libffi was not found in the pkg-config search path.

Perhaps you should add the directory containing `libffi.pc'

to the PKG_CONFIG_PATH environment variable

No package 'libffi' found

Package libffi was not found in the pkg-config search path.

Perhaps you should add the directory containing `libffi.pc'

to the PKG_CONFIG_PATH environment variable

No package 'libffi' found

Package libffi was not found in the pkg-config search path.

Perhaps you should add the directory containing `libffi.pc'

to the PKG_CONFIG_PATH environment variable

No package 'libffi' found

Package libffi was not found in the pkg-config search path.

Perhaps you should add the directory containing `libffi.pc'

to the PKG_CONFIG_PATH environment variable

No package 'libffi' found

c/_cffi_backend.c:2:20: fatal error: Python.h: No such file or directory

 #include <Python.h>

                    ^

compilation terminated.

Traceback (most recent call last):

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

  File "/tmp/pip-build-2gl72v/cryptography/setup.py", line 319, in <module>

    **keywords_with_side_effects(sys.argv)

  File "/home/pi/.local/lib/python2.7/site-packages/setuptools/__init__.py", line 128, in $

    _install_setup_requires(attrs)

  File "/home/pi/.local/lib/python2.7/site-packages/setuptools/__init__.py", line 123, in $

    dist.fetch_build_eggs(dist.setup_requires)

  File "/home/pi/.local/lib/python2.7/site-packages/setuptools/dist.py", line 514, in fetc$

    replace_conflicting=True,

  File "/home/pi/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 770, $

    replace_conflicting=replace_conflicting

  File "/home/pi/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1053,$

    return self.obtain(req, installer)

  File "/home/pi/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1065,$

    return installer(requirement)

  File "/home/pi/.local/lib/python2.7/site-packages/setuptools/dist.py", line 581, in fetc$

    return cmd.easy_install(req)

  File "/home/pi/.local/lib/python2.7/site-packages/setuptools/command/easy_install.py", l$

    return self.install_item(spec, dist.location, tmpdir, deps)

  File "/home/pi/.local/lib/python2.7/site-packages/setuptools/command/easy_install.py", l$

    dists = self.install_eggs(spec, download, tmpdir)

  File "/home/pi/.local/lib/python2.7/site-packages/setuptools/command/easy_install.py", l$

    return self.build_and_install(setup_script, setup_base)

  File "/home/pi/.local/lib/python2.7/site-packages/setuptools/command/easy_install.py", l$

    self.run_setup(setup_script, setup_base, args)

  File "/home/pi/.local/lib/python2.7/site-packages/setuptools/command/easy_install.py", l$

    raise DistutilsError("Setup script exited with %s" % (v.args[0],))

distutils.errors.DistutilsError: Setup script exited with error: command 'arm-linux-gnueab$

----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-2gl72v/cr$
Exception information:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 295, in run
    requirement_set.install(install_options, global_options, root=options.root_path)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1436, in install
    requirement.install(install_options, global_options, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 707, in install
    cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
  File "/usr/lib/python2.7/dist-packages/pip/util.py", line 716, in call_subprocess
    % (command_desc, proc.returncode, cwd))
InstallationError: Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/$

我不知道为什么会发生这种情况。

4

1 回答 1

0

通过首先更新 pip,我最近在类似的情况下很幸运。

sudo apt-get install -y python3-pip
sudo pip3 -H pip3 install --upgrade pip
于 2018-05-28T23:06:16.090 回答