无法在Cent OS中安装Paramiko

时间:2016-06-06 17:06:15

标签: python pip paramiko libffi

最近我正在尝试学习python并在工作期间编写一些脚本。但是我发现我的python没有更新到目前为止。所以我根据网络的一些指南从2.6升级到2.7.6。之后,python,pip和easy_install似乎都没问题。 然后我尝试使用pip安装Paramiko。错误显示libffi未找到如下。但是,当我尝试安装libffi时,它已经显示在那里。我试图搜索其他任何包,但没有。

问题是pip试图找到libffi.pc,但它不在任何软件包中。

有人能帮我一把吗?

谢谢!

[root@vmx-dsm-038 ~]# pip install paramiko
Requirement already satisfied (use --upgrade to upgrade): paramiko in /usr/local/lib/python2.7/site-packages/paramiko-2.0.0-py2.7.egg
Collecting cryptography>=1.1 (from paramiko)
/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
  SNIMissingWarning
/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Using cached cryptography-1.4.tar.gz
Requirement already satisfied (use --upgrade to upgrade): pyasn1>=0.1.7 in /usr/local/lib/python2.7/site-packages (from paramiko)
Requirement already satisfied (use --upgrade to upgrade): idna>=2.0 in /usr/local/lib/python2.7/site-packages (from cryptography>=1.1->paramiko)
Requirement already satisfied (use --upgrade to upgrade): six>=1.4.1 in /usr/local/lib/python2.7/site-packages (from cryptography>=1.1->paramiko)
Requirement already satisfied (use --upgrade to upgrade): setuptools>=11.3 in /usr/local/lib/python2.7/site-packages/setuptools-22.0.5-py2.7.egg (from cryptography>=1.1->paramiko)
Requirement already satisfied (use --upgrade to upgrade): enum34 in /usr/local/lib/python2.7/site-packages (from cryptography>=1.1->paramiko)
Requirement already satisfied (use --upgrade to upgrade): ipaddress in /usr/local/lib/python2.7/site-packages (from cryptography>=1.1->paramiko)
Collecting cffi>=1.4.1 (from cryptography>=1.1->paramiko)
  Using cached cffi-1.6.0.tar.gz
Requirement already satisfied (use --upgrade to upgrade): pycparser in /usr/local/lib/python2.7/site-packages (from cffi>=1.4.1->cryptography>=1.1->paramiko)
Building wheels for collected packages: cryptography, cffi
  Running setup.py bdist_wheel for cryptography ... error
  Complete output from command /usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-TN9_mw/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmpQ9VyZFpip-wheel- --python-tag cp27:
  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: error: ffi.h: No such file or directory
  In file included from c/_cffi_backend.c:63:
[root@vmx-dsm-038 ~]# yum install libffi
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Setting up Install Process
Package libffi-3.0.5-3.2.el6.x86_64 already installed and latest version
Nothing to do

[root@vmx-dsm-038 ~]# yum search libffi
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
====================================================================================== N/S Matched: libffi ======================================================================================
libffi.i686 : A portable foreign function interface library
libffi.x86_64 : A portable foreign function interface library

  Name and summary matches only, use "search all" for everything.

[root@vmx-dsm-038 ~]# rpm -ql libffi.x86_64
/usr/lib64/libffi.so.5
/usr/lib64/libffi.so.5.0.6
/usr/share/doc/libffi-3.0.5
/usr/share/doc/libffi-3.0.5/LICENSE
/usr/share/doc/libffi-3.0.5/README


[root@vmx-dsm-038 ~]# yum install libffi-devel
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Setting up Install Process
No package libffi-devel available.
Error: Nothing to do

[root@vmx-dsm-038 ~]# yum upgrade libffi-devel
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Setting up Upgrade Process
No Match for argument: libffi-devel
No package libffi-devel available.
No Packages marked for Update
[root@vmx-dsm-038 ~]# yum upgrade libffi
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Setting up Upgrade Process
No Packages marked for Update

[root@vmx-dsm-038 ~]# locate libffi
/opt/Python-2.7.6/Modules/_ctypes/libffi
/opt/Python-2.7.6/Modules/_ctypes/libffi.diff
/opt/Python-2.7.6/Modules/_ctypes/libffi_arm_wince
/opt/Python-2.7.6/Modules/_ctypes/libffi_msvc
......
/opt/Python-2.7.6/build/temp.linux-x86_64-2.7/libffi/src/xtensa/.deps/sysv.Plo
/opt/Python-2.7.6/build/temp.linux-x86_64-2.7/libffi/testsuite/Makefile
/opt/Python-2.7.6/build/temp.linux-x86_64-2.7/opt/Python-2.7.6/Modules/_ctypes/libffi
/opt/Python-2.7.6/build/temp.linux-x86_64-2.7/opt/Python-2.7.6/Modules/_ctypes/libffi/src
/opt/Python-2.7.6/build/temp.linux-x86_64-2.7/opt/Python-2.7.6/Modules/_ctypes/libffi/src/closures.o
/opt/Python-2.7.6/build/temp.linux-x86_64-2.7/opt/Python-2.7.6/Modules/_ctypes/libffi/src/prep_cif.o
/opt/Python-2.7.6/build/temp.linux-x86_64-2.7/opt/Python-2.7.6/Modules/_ctypes/libffi/src/x86
/opt/Python-2.7.6/build/temp.linux-x86_64-2.7/opt/Python-2.7.6/Modules/_ctypes/libffi/src/x86/ffi.o
/opt/Python-2.7.6/build/temp.linux-x86_64-2.7/opt/Python-2.7.6/Modules/_ctypes/libffi/src/x86/ffi64.o
/opt/Python-2.7.6/build/temp.linux-x86_64-2.7/opt/Python-2.7.6/Modules/_ctypes/libffi/src/x86/sysv.o
/opt/Python-2.7.6/build/temp.linux-x86_64-2.7/opt/Python-2.7.6/Modules/_ctypes/libffi/src/x86/unix64.o
/usr/lib64/libffi.so.5
/usr/lib64/libffi.so.5.0.6
/usr/share/doc/libffi-3.0.5
/usr/share/doc/libffi-3.0.5/LICENSE
/usr/share/doc/libffi-3.0.5/README
/var/lib/yum/yumdb/l/66af3a78b71c9ab35c98a0a9bcd1cb15d195d206-libffi-3.0.5-3.2.el6-x86_64
/var/lib/yum/yumdb/l/66af3a78b71c9ab35c98a0a9bcd1cb15d195d206-libffi-3.0.5-3.2.el6-x86_64/checksum_data
/var/lib/yum/yumdb/l/66af3a78b71c9ab35c98a0a9bcd1cb15d195d206-libffi-3.0.5-3.2.el6-x86_64/checksum_type
/var/lib/yum/yumdb/l/66af3a78b71c9ab35c98a0a9bcd1cb15d195d206-libffi-3.0.5-3.2.el6-x86_64/from_repo
/var/lib/yum/yumdb/l/66af3a78b71c9ab35c98a0a9bcd1cb15d195d206-libffi-3.0.5-3.2.el6-x86_64/from_repo_revision
/var/lib/yum/yumdb/l/66af3a78b71c9ab35c98a0a9bcd1cb15d195d206-libffi-3.0.5-3.2.el6-x86_64/from_repo_timestamp
/var/lib/yum/yumdb/l/66af3a78b71c9ab35c98a0a9bcd1cb15d195d206-libffi-3.0.5-3.2.el6-x86_64/installed_by
/var/lib/yum/yumdb/l/66af3a78b71c9ab35c98a0a9bcd1cb15d195d206-libffi-3.0.5-3.2.el6-x86_64/reason
/var/lib/yum/yumdb/l/66af3a78b71c9ab35c98a0a9bcd1cb15d195d206-libffi-3.0.5-3.2.el6-x86_64/releasever

1 个答案:

答案 0 :(得分:0)

我终于找到了解决方案。谢谢NepCoder! 我手动从页面https://pkgs.org/centos-6/centos-x86_64/libffi-devel-3.0.5-3.2.el6.x86_64.rpm.html下载libffi-devel。然后使用' rpm -ivh libffi-devel-3.0.5-3.2.el6.x86_64.rpm'将它安装在我的VM上。

之后一切正常。我想我的yum回购可能有问题。