pip安装请求[security]在一个virtualenv失败的构建轮加密和cffi [英] pip install requests[security] on a virtualenv fails building wheel for cryptography and cffi

查看:492
本文介绍了pip安装请求[security]在一个virtualenv失败的构建轮加密和cffi的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个在虚拟环境中使用django我注意到在使用pip时出现InsecurePlatformWarning。搜索引导我到这个SO文章[我不能链接],但是我得到这个:

While following this and this to use django in virtual environments I noticed that a InsecurePlatformWarning comes up while using pip. Searching lead me to this SO post [which I cannot link] but then I get this:

(doconenv){me}@{hostname} /media/{me}/{route} $ pip install cryptography
Collecting cryptography
/media/{me}/{route}/doconenv/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Using cached cryptography-1.0.1.tar.gz
Requirement already satisfied (use --upgrade to upgrade): idna>=2.0 in ./doconenv/lib/python2.7/site-packages (from cryptography)
Requirement already satisfied (use --upgrade to upgrade): pyasn1>=0.1.8 in ./doconenv/lib/python2.7/site-packages (from cryptography)
Requirement already satisfied (use --upgrade to upgrade): six>=1.4.1 in ./doconenv/lib/python2.7/site-packages (from cryptography)
Requirement already satisfied (use --upgrade to upgrade): setuptools in ./doconenv/lib/python2.7/site-packages (from cryptography)
Requirement already satisfied (use --upgrade to upgrade): enum34 in ./doconenv/lib/python2.7/site-packages (from cryptography)
Requirement already satisfied (use --upgrade to upgrade): ipaddress in ./doconenv/lib/python2.7/site-packages (from cryptography)
Collecting cffi>=1.1.0 (from cryptography)
  Using cached cffi-1.2.1.tar.gz
Requirement already satisfied (use --upgrade to upgrade): pycparser in ./doconenv/lib/python2.7/site-packages (from cffi>=1.1.0->cryptography)
Building wheels for collected packages: cryptography, cffi
  Running setup.py bdist_wheel for cryptography
  Complete output from command /media/{me}/{route}/doconenv/bin/python -c "import setuptools;__file__='/tmp/pip-build-SsTBPB/cryptography/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmpaZKxJjpip-wheel-:
  c/_cffi_backend.c:2:20: fatal error: Python.h: No existe el archivo o el directorio
   #include <Python.h>
                      ^
  compilation terminated.
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-build-SsTBPB/cryptography/setup.py", line 313, in <module>
      **keywords_with_side_effects(sys.argv)
    File "/usr/lib/python2.7/distutils/core.py", line 111, in setup
      _setup_distribution = dist = klass(attrs)
    File "/media/{me}/{route}/doconenv/local/lib/python2.7/site-packages/setuptools/dist.py", line 268, in __init__
      self.fetch_build_eggs(attrs['setup_requires'])
    File "/media/{me}/{route}/doconenv/local/lib/python2.7/site-packages/setuptools/dist.py", line 313, in fetch_build_eggs
      replace_conflicting=True,
    File "/media/{me}/{route}/doconenv/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 836, in resolve
      dist = best[req.key] = env.best_match(req, ws, installer)
    File "/media/{me}/{route}/doconenv/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1081, in best_match
      return self.obtain(req, installer)
    File "/media/{me}/{route}/doconenv/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1093, in obtain
      return installer(requirement)
    File "/media/{me}/{route}/doconenv/local/lib/python2.7/site-packages/setuptools/dist.py", line 380, in fetch_build_egg
      return cmd.easy_install(req)
    File "/media/{me}/{route}/doconenv/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 629, in easy_install
      return self.install_item(spec, dist.location, tmpdir, deps)
    File "/media/{me}/{route}/doconenv/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 659, in install_item
      dists = self.install_eggs(spec, download, tmpdir)
    File "/media/{me}/{route}/doconenv/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 842, in install_eggs
      return self.build_and_install(setup_script, setup_base)
    File "/media/{me}/{route}/doconenv/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1070, in build_and_install
      self.run_setup(setup_script, setup_base, args)
    File "/media/{me}/{route}/doconenv/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1058, in run_setup
      raise DistutilsError("Setup script exited with %s" % (v.args[0],))
  distutils.errors.DistutilsError: Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for cryptography
  Running setup.py bdist_wheel for cffi
  Complete output from command /media/{me}/{route}/doconenv/bin/python -c "import setuptools;__file__='/tmp/pip-build-SsTBPB/cffi/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmpNAcsxupip-wheel-:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-2.7
  creating build/lib.linux-x86_64-2.7/cffi
  copying cffi/ffiplatform.py -> build/lib.linux-x86_64-2.7/cffi
  copying cffi/model.py -> build/lib.linux-x86_64-2.7/cffi
  copying cffi/recompiler.py -> build/lib.linux-x86_64-2.7/cffi
  copying cffi/__init__.py -> build/lib.linux-x86_64-2.7/cffi
  copying cffi/setuptools_ext.py -> build/lib.linux-x86_64-2.7/cffi
  copying cffi/lock.py -> build/lib.linux-x86_64-2.7/cffi
  copying cffi/vengine_gen.py -> build/lib.linux-x86_64-2.7/cffi
  copying cffi/cffi_opcode.py -> build/lib.linux-x86_64-2.7/cffi
  copying cffi/api.py -> build/lib.linux-x86_64-2.7/cffi
  copying cffi/backend_ctypes.py -> build/lib.linux-x86_64-2.7/cffi
  copying cffi/verifier.py -> build/lib.linux-x86_64-2.7/cffi
  copying cffi/vengine_cpy.py -> build/lib.linux-x86_64-2.7/cffi
  copying cffi/gc_weakref.py -> build/lib.linux-x86_64-2.7/cffi
  copying cffi/commontypes.py -> build/lib.linux-x86_64-2.7/cffi
  copying cffi/cparser.py -> build/lib.linux-x86_64-2.7/cffi
  copying cffi/_cffi_include.h -> build/lib.linux-x86_64-2.7/cffi
  copying cffi/parse_c_type.h -> build/lib.linux-x86_64-2.7/cffi
  running build_ext
  building '_cffi_backend' extension
  creating build/temp.linux-x86_64-2.7
  creating build/temp.linux-x86_64-2.7/c
  x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DUSE__THREAD -I/usr/include/python2.7 -c c/_cffi_backend.c -o build/temp.linux-x86_64-2.7/c/_cffi_backend.o
  c/_cffi_backend.c:2:20: fatal error: Python.h: No existe el archivo o el directorio
   #include <Python.h>
                      ^
  compilation terminated.
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for cffi
Failed to build cryptography cffi
Installing collected packages: cffi, cryptography
  Running setup.py install for cffi
    Complete output from command /media/{me}/{route}/doconenv/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-SsTBPB/cffi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-nbEEUN-record/install-record.txt --single-version-externally-managed --compile --install-headers /media/{me}/{route}/doconenv/include/site/python2.7/cffi:
    running install
    running build
    running build_py
    running build_ext
    building '_cffi_backend' extension
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DUSE__THREAD -I/usr/include/python2.7 -c c/_cffi_backend.c -o build/temp.linux-x86_64-2.7/c/_cffi_backend.o
    c/_cffi_backend.c:2:20: fatal error: Python.h: No existe el archivo o el directorio
     #include <Python.h>
                        ^
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
Command "/media/{me}/{route}/doconenv/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-SsTBPB/cffi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-nbEEUN-record/install-record.txt --single-version-externally-managed --compile --install-headers /media/{me}/{route}/doconenv/include/site/python2.7/cffi" failed with error code 1 in /tmp/pip-build-SsTBPB/cffi

我应该补充说,我使用的是Linum Mint 17.1

I should add that I'm using Linum Mint 17.1

推荐答案

您需要安装Python和其他库开发人员包,例如,如果您使用Ubuntu,请运行以下命令:

You need to install Python and other libraries developer packages, for example if you use Ubuntu, run this command:

sudo apt-get install libpython2.7-dev

这篇关于pip安装请求[security]在一个virtualenv失败的构建轮加密和cffi的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆