在这篇文章中,我们将为您详细介绍Command"pythonsetup.pyegg_info"failedwitherrorcode1in/tmp/pip-build-vqeCP7/Django/的内
在这篇文章中,我们将为您详细介绍Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-vqeCP7/Django/的内容。此外,我们还会涉及一些关于 error: command ''gcc'' failed with exit status 1 ,python 安装 pyhs2 失败、centos7 安装 mysqlclient 报错 ERROR: Command errored out with exit status 1: python setup.py egg_info Check、cffi.ffiplatform.VerificationError: CompileError: command ''gcc'' failed with exit status 1、clang: error: linker command failed with exit code 1的知识,以帮助您更全面地了解这个主题。
本文目录一览:- Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-vqeCP7/Django/
- error: command ''gcc'' failed with exit status 1 ,python 安装 pyhs2 失败
- centos7 安装 mysqlclient 报错 ERROR: Command errored out with exit status 1: python setup.py egg_info Check
- cffi.ffiplatform.VerificationError: CompileError: command ''gcc'' failed with exit status 1
- clang: error: linker command failed with exit code 1
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-vqeCP7/Django/
这个是使用 pip 安装 django 的报错
root@ubuntu:/# pip install Django
Collecting Django
Using cached Django-2.0.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-vqeCP7/Django/setup.py", line 32, in <module>
version = __import__(''django'').get_version()
File "django/__init__.py", line 1, in <module>
from django.utils.version import get_version
File "django/utils/version.py", line 61, in <module>
@functools.lru_cache()
AttributeError: ''module'' object has no attribute ''lru_cache''
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-vqeCP7/Django/
错误的原因:pip 版本是 py2.7 的管理器,而 pip install django 默认是安装 django 的最新版本
root@ubuntu:/# pip --version
pip 9.0.1 from /usr/local/lib/python2.7/dist-packages (python 2.7)
django 的最新版本要支持 py3,所以要用 pip3(py3 的包管理器)安装
root@ubuntu:/# pip3 --version
pip 8.1.1 from /usr/lib/python3/dist-packages (python 3.5)
root@ubuntu:/# pip3 install django
Collecting django
Downloading Django-2.0-py3-none-any.whl (7.1MB)
100% |████████████████████████████████| 7.1MB 190kB/s
Collecting pytz (from django)
Downloading pytz-2017.3-py2.py3-none-any.whl (511kB)
100% |████████████████████████████████| 512kB 2.6MB/s
Installing collected packages: pytz, django
Successfully installed django-2.0 pytz-2017.3 #2.0版本需要py3支持
而 py2 想安装之前版本的 django 则需要指定版本
root@ubuntu:/# pip install django==1.10.6
Collecting django==1.10.6
Downloading Django-1.10.6-py2.py3-none-any.whl (6.8MB)
100% |████████████████████████████████| 6.8MB 135kB/s
Installing collected packages: django
Successfully installed django-1.10.6
root@ubuntu:/# pip --version
pip 9.0.1 from /usr/local/lib/python2.7/dist-packages (python 2.7)
error: command ''gcc'' failed with exit status 1 ,python 安装 pyhs2 失败
copying sasl/saslwrapper.pyx -> build/lib.linux-x86_64-2.7/sasl
running build_ext
building ''sasl.saslwrapper'' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/sasl
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Isasl -I/root/anaconda2/include/python2.7 -c sasl/saslwrapper.cpp -o build/temp.linux-x86_64-2.7/sasl/saslwrapper.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
In file included from sasl/saslwrapper.cpp:254:0:
sasl/saslwrapper.h:22:23: fatal error: sasl/sasl.h: No such file or directory
#include <sasl/sasl.h>
^
compilation terminated.
error: command ''gcc'' failed with exit status 1
----------------------------------------
Command "/root/anaconda2/bin/python -u -c "import setuptools, tokenize;__file__=''/tmp/pip-build-DLlXxp/sasl/setup.py'';f=getattr(tokenize, ''open'', open)(__file__);code=f.read().replace(''\r\n'', ''\n'');f.close();exec(compile(code, __file__, ''exec''))" install --record /tmp/pip-n5E30n-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-DLlXxp/sasl/
centos7 安装 mysqlclient 报错 ERROR: Command errored out with exit status 1: python setup.py egg_info Check
报错:ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
- 解决方案
ln -s /usr/local/mysql/bin/mysql_config /usr/local/bin/mysql_config
- 还是报错
yum install mysql-devel
cffi.ffiplatform.VerificationError: CompileError: command ''gcc'' failed with exit status 1
意思是需要升级 GCC
yum -y install gcc
clang: error: linker command failed with exit code 1
之前在 macOS 10.13 上参照官方文档 build 了 LLVM 和 Clang,而在使用 clang++
编译时有时会遇到如题的问题,具体报错信息如下:
Undefined symbols for architecture x86_64:
"std::string::compare(char const*) const", referenced from:
get_token() in toy-28f990.o
"std::string::_M_replace_aux(unsigned long, unsigned long, unsigned long, char)", referenced from:
get_token() in toy-28f990.o
"std::string::_Rep::_M_destroy(std::allocator<char> const&)", referenced from:
get_token() in toy-28f990.o
"std::string::_Rep::_S_empty_rep_storage", referenced from:
get_token() in toy-28f990.o
__GLOBAL__sub_I_toy.cpp in toy-28f990.o
"std::string::reserve(unsigned long)", referenced from:
get_token() in toy-28f990.o
"std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()", referenced from:
__GLOBAL__sub_I_toy.cpp in toy-28f990.o
ld: symbol(s) not found for architecture x86_64
clang-9: error: linker command failed with exit code 1 (use -v to see invocation)
原因是默认的 C++ runtime library 是 libc++
,而非 libstdc++
,前者把 std::string
放在非标准 namespace std::_1::_string
下。
我们可以用下面这个简单的 C++11 程序来测试默认的 C++ runtime library 是 libc++ 还是 libstdc++。
#include <iostream>
#include <random>
int main() {
int&& x = 10;
std::cout << x << std::endl;
return 0;
}
编译之后使用 otool
查看链接的 binary。
g++ -std=c++11 random.cpp -o random
otool -L random
输出如下:
random:
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4)
可以看到链接的是 libc++。
改用 brew 安装的 g++-4.9
编译,输出为:
random:
/usr/local/opt/gcc@4.9/lib/gcc/4.9/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.20.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4)
/usr/local/lib/gcc/4.9/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
系统也提供了 libstdc++,路径为 /usr/lib/libstdc++.6.dylib
。
要解决上述原因导致的如题的问题,有两种方法。
一是在编译时指定 stdlib
:
g++ -std=c++11 -stdlib=libstdc++ source.cpp -o source
二是重新 build LLVM 和 Clang,修改 llvm-project/clang/lib/Frontend/InitHeaderSearch.cpp
中以下代码段:
case llvm::Triple::x86:
case llvm::Triple::x86_64:
IsBaseFound = AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1",
"i686-apple-darwin10", "",
"x86_64", triple);
IsBaseFound |= AddGnuCPlusPlusIncludePaths(
"/usr/include/c++/4.0.0", "i686-apple-darwin8", "", "", triple);
break;
为:
case llvm::Triple::x86:
case llvm::Triple::x86_64:
IsBaseFound = AddGnuCPlusPlusIncludePaths("/usr/local/opt/gcc@4.9/include/c++/4.9.4",
"x86_64-apple-darwin17.3.0", "",
"x86_64", triple);
break;
参考:Compile clang against libstdc++ with C++11 support on a Mac
今天关于Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-vqeCP7/Django/的分享就到这里,希望大家有所收获,若想了解更多关于 error: command ''gcc'' failed with exit status 1 ,python 安装 pyhs2 失败、centos7 安装 mysqlclient 报错 ERROR: Command errored out with exit status 1: python setup.py egg_info Check、cffi.ffiplatform.VerificationError: CompileError: command ''gcc'' failed with exit status 1、clang: error: linker command failed with exit code 1等相关知识,可以在本站进行查询。
本文标签: