无法安装软件包 pysftp,找不到软件包"libffi",失败,错误代码为 1



我正在 pi 零 w 上进行干净的 raspian 拉伸安装并尝试安装pysftp

pip install pysftp

给出以下错误:

Collecting pysftp
Using cached https://files.pythonhosted.org/packages/36/60/45f30390a38b1f92e0a8cf4de178cd7c2bc3f874c85430e40ccf99df8fe7/pysftp-0.2.9.tar.gz
Collecting paramiko>=1.17 (from pysftp)
Using cached https://files.pythonhosted.org/packages/3e/db/cb7b6656e0e7387637ce850689084dc0b94b44df31cc52e5fc5c2c4fd2c1/paramiko-2.4.1-py2.py3-none-any.whl
Collecting pynacl>=1.0.1 (from paramiko>=1.17->pysftp)
Using cached https://files.pythonhosted.org/packages/08/19/cf56e60efd122fa6d2228118a9b345455b13ffe16a14be81d025b03b261f/PyNaCl-1.2.1.tar.gz
Complete output from command python setup.py egg_info:
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:15:17: fatal error: ffi.h: No such file or directory
#include <ffi.h>
^
compilation terminated.
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-63NrlL/pynacl/setup.py", line 251, in <module>
"Programming Language :: Python :: 3.6",
File "/home/pi/.local/lib/python2.7/site-packages/setuptools/__init__.py", line 128, in setup
_install_setup_requires(attrs)
File "/home/pi/.local/lib/python2.7/site-packages/setuptools/__init__.py", line 123, in _install_setup_requires
dist.fetch_build_eggs(dist.setup_requires)
File "/home/pi/.local/lib/python2.7/site-packages/setuptools/dist.py", line 514, in fetch_build_eggs
replace_conflicting=True,
File "/home/pi/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 770, in resolve
replace_conflicting=replace_conflicting
File "/home/pi/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1053, in best_match
return self.obtain(req, installer)
File "/home/pi/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1065, in obtain
return installer(requirement)
File "/home/pi/.local/lib/python2.7/site-packages/setuptools/dist.py", line 581, in fetch_build_egg
return cmd.easy_install(req)
File "/home/pi/.local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 673, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/home/pi/.local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 699, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/home/pi/.local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 884, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "/home/pi/.local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1152, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "/home/pi/.local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1140, in run_setup
raise DistutilsError("Setup script exited with %s" % (v.args[0],))
distutils.errors.DistutilsError: Setup script exited with error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-63NrlL/pynacl/

我尝试升级安装工具并安装ez_setup

pip install --upgrade setuptools
pip install ez_setup

这并没有改变任何东西,还尝试安装丢失的软件包

pip install libffi
pip install cffi

但这一切都失败了。我尝试了在互联网上找到的所有内容,但没有任何效果。浪费了几个小时...我到底错过了什么?

编辑: 还尝试过:

pip install libffi-dev

但这会导致:

Could not find a version that satisfies the requirement libffi-dev (from versions: )
No matching distribution found for libffi-dev

试:

sudo apt-get libffi-dev

但它会导致:

Package libffi-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'libffi-dev' has no installation candidate

它也发生在我身上。我终于找到了一个有效的答案。我只是在添加pysftp之前添加了cffi模块。pip install cffi然后pip install pysftp.

最新更新