2015-09-26 66 views
2

虽然以下thisthis在虚拟环境中使用django我注意到,使用pip时出现InsecurePlatformWarning。搜索导致我这个SO发布[我不能链接]但后来我得到这个:pip安装请求[安全]上virtualenv失败的建筑轮加密和cffi

(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 

我要补充一点,我使用的是亚麻薄荷17.1

+0

[这](http://stackoverflow.com/questions/29134512/insecureplatformwarning-a-true-sslcontext-object-is-not-available -this-prevent)是如此发帖 – Jedabero

回答

4

您需要安装Python和其他库的开发包,例如,如果你使用Ubuntu,运行这个命令:

sudo apt-get install libpython2.7-dev 
+0

谢谢 安装securit在一个新的env y extras工作顺利,并且警告消失 – Jedabero

+0

我遇到了同样的问题,你如何解决它? – erical

+0

@erical安装libpython2.7-dev就足够了 – Jedabero