由于缺少libffi,无法在树莓派上安装加密库。
由于缺少libffi,无法在树莓派上安装加密库。
这个问题已经有了答案:
pip install failing with: OSError: [Errno 13] Permission denied on directory
我一直在尝试在我的 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 "", line 17, in File "/tmp/pip-build-wg353po4/cryptography/setup.py", line 28, in "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 "", line 17, in File "/tmp/pip-build-wg353po4/cryptography/setup.py", line 28, in "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
(这些来自尝试单独安装密码学库的日志,但安装flask-ask时遇到同样的错误)
我尝试使用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
那么该怎么办?我已经尝试了很多不同的搜索,我看到其他人在树莓派上有密码学问题,但不是这个特定的问题。
编辑: 好的,现在我已经使用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 ^ compilation terminated. Traceback (most recent call last): File "", line 1, in File "/tmp/pip-build-2gl72v/cryptography/setup.py", line 319, in **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 ^ compilation terminated. Traceback (most recent call last): File "", line 1, in File "/tmp/pip-build-2gl72v/cryptography/setup.py", line 319, in **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/$
这个时候我完全不知道为什么会发生这种情况。
admin 更改状态以发布 2023年5月21日