virtualenv gcc 错误

发布于 2024-11-03 06:47:21 字数 1901 浏览 0 评论 0原文

如果我在创建 virtualenv 时使用 --no-site-packages 选项并尝试安装 MySQL-python 之后我得到:

error: command 'gcc' failed with exit status 1

以下是我遵循的步骤:

easy_install-2.7 --install-dir ~/src/lib/ virtualenv==dev
~/src/lib/virtualenv  --no-site-packages ENV
.../ENV/bin/pip-2.7 install MySQL-python

我还尝试下载 mySQL-python 并使用安装

.../ENV/bin/python setup.py build

我得到相同的错误枯萎方式。 我假设我缺少此 virtualenv 中的 gcc,但如何在仍使用 --no-site-packages 选项的情况下将其安装在此 virtualenv 中。 谢谢

编辑:根据下面的评论,这里是整个错误输出。

running build
running build_py
copying MySQLdb/release.py -> build/lib.linux-x86_64-2.7/MySQLdb
running build_ext
building '_mysql' extension
gcc -m32 -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/usr/include/mysql -I/opt/lampp/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv
In file included from /opt/lampp/include/python2.7/Python.h:58,
                 from pymemcompat.h:10,
                 from _mysql.c:29:
/opt/lampp/include/python2.7/pyport.h:849:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
In file included from /usr/include/mysql/my_config.h:11,
                 from _mysql.c:36:
/usr/include/mysql/my_config_x86_64.h:1032:1: warning: "SIZEOF_LONG" redefined
In file included from /opt/lampp/include/python2.7/Python.h:8,
                 from pymemcompat.h:10,
                 from _mysql.c:29:
/opt/lampp/include/python2.7/pyconfig.h:989:1: warning: this is the location of the previous definition
error: command 'gcc' failed with exit status 1

IF I use --no-site-packages option while creating a virtualenv and try to install MySQL-python afterwards I get :

error: command 'gcc' failed with exit status 1

Here are the steps I followed:

easy_install-2.7 --install-dir ~/src/lib/ virtualenv==dev
~/src/lib/virtualenv  --no-site-packages ENV
.../ENV/bin/pip-2.7 install MySQL-python

I also tried downloading mySQL-python and install using

.../ENV/bin/python setup.py build

I get the same error wither way.
I assume I am missing the gcc from this virtualenv but how do I get it installed in this virtualenv while still using --no-site-packages option.
thanks

EDIT: as per below comments here is the whole error output.

running build
running build_py
copying MySQLdb/release.py -> build/lib.linux-x86_64-2.7/MySQLdb
running build_ext
building '_mysql' extension
gcc -m32 -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/usr/include/mysql -I/opt/lampp/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv
In file included from /opt/lampp/include/python2.7/Python.h:58,
                 from pymemcompat.h:10,
                 from _mysql.c:29:
/opt/lampp/include/python2.7/pyport.h:849:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
In file included from /usr/include/mysql/my_config.h:11,
                 from _mysql.c:36:
/usr/include/mysql/my_config_x86_64.h:1032:1: warning: "SIZEOF_LONG" redefined
In file included from /opt/lampp/include/python2.7/Python.h:8,
                 from pymemcompat.h:10,
                 from _mysql.c:29:
/opt/lampp/include/python2.7/pyconfig.h:989:1: warning: this is the location of the previous definition
error: command 'gcc' failed with exit status 1

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

微暖i 2024-11-10 06:47:21

你需要 mysql-devel 包。要安装,您需要指定实际的包名称 -

sudo apt-get install libmysql++-dev

you need the mysql-devel package. to install, you need to specify the actual package name -

sudo apt-get install libmysql++-dev
请爱~陌生人 2024-11-10 06:47:21

您是否尝试过使用 sudo 命令?我猜您遇到的是权限问题,而不是这里的其他问题。通常,安装会抛出此错误,因为它试图访问具有您不拥有的 root 权限的目录。

Have you tried using the sudo command. I am guessing you are having permission issues than issue with anything else here. Usually an install throws up this error as it is trying to access directories with root permission which you don't own.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文