Python 2.7 &引用;错误:命令';x86#u 64-linux-gnu-gcc';失败,退出状态为“1”;虚拟的
环境:Linux Mint 17肉桂 将显示此错误:Python 2.7 &引用;错误:命令';x86#u 64-linux-gnu-gcc';失败,退出状态为“1”;虚拟的,python-2.7,pip,virtualenv,linux-mint,Python 2.7,Pip,Virtualenv,Linux Mint,环境:Linux Mint 17肉桂 将显示此错误: error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 在virtualenv中尝试以下操作时: pip install lxml pip install pillow pip install pycrypto pip install pymongo (fails but still shows in pip freeze) pip install pillow pi
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
在virtualenv
中尝试以下操作时:
pip install lxml
pip install pillow
pip install pycrypto
pip install pymongo (fails but still shows in pip freeze)
pip install pillow
pip install pycrypto
这里有几种解决方案建议安装python2.7-dev
:
sudo apt-get install libffi libffi-dev
然而,我对这一建议感到困惑,因为我的理解是,使用以下内容:
sudo apt-get install python2.7-dev
将其添加到Python的主*system*实例,而不是virtualenv
中的实例。(见-)
我可以将
python2.7-dev
添加到Python的virtualenv
版本吗 我通过Linux Mint 17中的Synaptic软件包管理器安装了python2.7-dev
然后,我可以在virtualenv
中完成以下任务:
pip install lxml
pip install pillow
pip install pycrypto
pip install pymongo (fails but still shows in pip freeze)
pip install pillow
pip install pycrypto
然后我通过Synaptic安装了libxml2 dev
和libxslt1 dev
,可以完成以下任务:
pip install lxml
我也这样做,以便pymongo安装没有任何错误:
pip uninstall pymongo
pip install pymongo # i defined the version i needed ie pip install pymongo==2.6.2
我仍然不知道这是如何解决问题的,因为我认为
virtualenv
是一个孤立的环境。对此,如有任何澄清,我们将不胜感激 这可能是pip中的一个问题。要解决此问题,请尝试:
sudo-apt-get-remove-python-pip
要安装pip,请安全下载get-pip.py
sudo-python get-pip.py
为我工作:只需先安装python2.7-dev即可
sudo apt get install python2.7-dev
对我来说,lxml的安装在编译时失败了。我按照安装lxml的说明进行操作,并减少了编译器优化:
sudo CFLAGS="-O0" pip install lxml
完成此操作后,lxml的编译成功。大多数情况下,这些都是依赖性问题 在gcc编译器的堆栈跟踪之后,可以看到丢失的文件。有时安装Python开发包是不够的 例如: 我尝试在我的virtualenv foo中执行
pip安装请求[安全]
。这是pip安装程序给我的结果
Failed building wheel for cryptography
Running setup.py bdist_wheel for cffi
Stored in directory: /root/.cache/pip/wheels/99/e7/9a/68b1c8ca6f6f92b5feebd4d9434f50712b84f6a66d1285ea21
Successfully built cffi
Failed to build cryptography
Installing collected packages: cffi, cryptography, pyOpenSSL, ndg-httpsclient, requests
Running setup.py install for cryptography
Complete output from command /opt/foo/django-cms-virtualenv/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-eZaLAG/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-BwgYTp-record/install-record.txt --single-version-externally-managed --compile --install-headers /opt/foo/django-cms-virtualenv/include/site/python2.7/cryptography:
running install
running build
running build_py
running egg_info
writing requirements to src/cryptography.egg-info/requires.txt
writing src/cryptography.egg-info/PKG-INFO
writing top-level names to src/cryptography.egg-info/top_level.txt
writing dependency_links to src/cryptography.egg-info/dependency_links.txt
writing entry points to src/cryptography.egg-info/entry_points.txt
warning: manifest_maker: standard file '-c' not found
reading manifest file 'src/cryptography.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
no previously-included directories found matching 'docs/_build'
warning: no previously-included files matching '*' found under directory 'vectors'
writing manifest file 'src/cryptography.egg-info/SOURCES.txt'
running build_ext
building '_Cryptography_cffi_a269d620xd5c405b7' extension
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c src/cryptography/hazmat/bindings/__pycache__/_Cryptography_cffi_a269d620xd5c405b7.c -o build/temp.linux-x86_64-2.7/src/cryptography/hazmat/bindings/__pycache__/_Cryptography_cffi_a269d620xd5c405b7.o
src/cryptography/hazmat/bindings/__pycache__/_Cryptography_cffi_a269d620xd5c405b7.c:217:25: fatal error: openssl/aes.h: Datei oder Verzeichnis nicht gefunden
#include <openssl/aes.h>
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
构建加密控制盘失败
正在运行用于cffi的setup.py bdist_wheel
存储在目录:/root/.cache/pip/wheels/99/e7/9a/68b1c8ca6f6f92b5feebd4d9434f50712b84f6a66d1285ea21中
成功构建cffi
无法建立加密
安装收集的软件包:cffi、加密、pyOpenSSL、ndg HttpSCClient、请求
正在运行setup.py安装以进行加密
从命令/opt/foo/django cms virtualenv/bin/python-c“import setuptools,tokenize;uuu file_uuu='/tmp/pip build eZaLAG/cryptography/setup.py';exec(compile(getattr(tokenize,'open',open)(uuu文件uu).read().replace('\r\n','\n'),u文件,'exec'))”安装--record/tmp/pip BwgYTp record/install-record.txt--外部管理的单一版本--编译--install headers/opt/foo/django cms virtualenv/include/site/python2.7/cryptography:
正在运行的安装
运行构建
运行build\u py
运行蛋_信息
将需求写入src/cryptography.egg-info/requires.txt
编写src/cryptography.egg-info/PKG-info
将顶级名称写入src/cryptography.egg-info/top_level.txt
将dependency_链接写入src/cryptography.egg-info/dependency_links.txt
将入口点写入src/cryptography.egg-info/entry_points.txt
警告:未找到清单制造商:标准文件'-c'
正在读取清单文件“src/cryptography.egg info/SOURCES.txt”
正在读取清单模板“manifest.in”
未找到与“docs/\u build”匹配的以前包含的目录
警告:在“vectors”目录下找不到以前包含的与“*”匹配的文件
正在写入清单文件“src/cryptography.egg info/SOURCES.txt”
运行build_ext
构建“\u加密\u cffi\u a269d620xd5c405b7”扩展
x86_64-linux-gnu-gcc-pthread-fno严格别名-DNDEBUG-g-fwrapv-O2-Wall-Wstrict原型-fPIC-I/usr/include/python2.7-c src/cryptography/hazmat/bindings/uuuuuu pycache\uuuuu/uuu密码学\u cffi a269d620xd5c405b7.c-o build/temp.linux-x86\u64-2.7/src/cryptography/hazmat/bindings/uuuu pycache\u695cx405;加密学/uxd607;
src/cryptography/hazmat/bindings/_pycache__/_cffi_a269d620xd5c405b7.c:217:25:致命错误:openssl/aes.h:Datei order Verzeichnis nicht gefunden
#包括
^
编译终止。
错误:命令“x86_64-linux-gnu-gcc”失败,退出状态为1
重要的部分是:#include
编译器非常清楚地表明它需要这个文件,但它不在文件系统中
知道了这一点,唯一要做的就是:安装所需的库强>
aptitude安装libssl dev
pip安装请求[安全]
cffi
库需要libffi dev
:
sudo apt-get install libffi libffi-dev
最简单的方法是:
sudo apt-get build-dep python-imaging
然后
pip install pillow
这适用于我,12.04,python2.7.6,适用于包lxml
sudo pip install libxml2 libxml2-dev libxslt1-dev
sudo pip install lxml
在Ubuntu 16.04.1中,这对我来说很有用:
sudo apt-get install libxml2-dev libxslt1-dev python-dev
这也适用于Ubuntu 14.10!非常感谢@user1063287,你救了我一天!:)很高兴从文档中听到@dhruvsingh:“
virtualenv
是一个创建隔离Python环境的工具。”他们的意思是从Python包的角度隔离。来自外部系统的C库、头文件、构建工具等都是可见的,甚至您的Python二进制文件也是可见的。它不是一个虚拟机或单独的Python二进制安装。对于“枕头”,您还需要sudo-apt-get-install-build-essential-libjpeg-dev-libzlib-dev
也为我工作!太好了,是的install libssl dev
解决了我在新Ubuntu 14.0上安装bpython时遇到的问题