Django 无法在虚拟环境中安装MySQLdB
在源代码进入虚拟环境之后 我已经做了以下工作:Django 无法在虚拟环境中安装MySQLdB,django,mysql-python,Django,Mysql Python,在源代码进入虚拟环境之后 我已经做了以下工作: pip install django pip install mysql-python 然后我遇到了以下错误 Collecting MYSQL-python Downloading MySQL-python-1.2.5.zip (108kB) 100% |████████████████████████████████| 110kB 387kB/s Installing collected packages: MYSQL-python Run
pip install django
pip install mysql-python
然后我遇到了以下错误
Collecting MYSQL-python
Downloading MySQL-python-1.2.5.zip (108kB)
100% |████████████████████████████████| 110kB 387kB/s
Installing collected packages: MYSQL-python
Running setup.py install for MYSQL-python
Complete output from command /Users/hainingwang/Dropbox/websites/django_projects/CVbuilder/CVbuilder/bin/python -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-CEs0Af/MYSQL-python/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-xUvIl_-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/hainingwang/Dropbox/websites/django_projects/CVbuilder/CVbuilder/include/site/python2.7/MYSQL-python:
running install
running build
running build_py
creating build
creating build/lib.macosx-10.5-x86_64-2.7
copying _mysql_exceptions.py -> build/lib.macosx-10.5-x86_64-2.7
creating build/lib.macosx-10.5-x86_64-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb
creating build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.macosx-10.5-x86_64-2.7
gcc -fno-strict-aliasing -I/Users/hainingwang/anaconda/include -arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/local/Cellar/mysql/5.6.24/include/mysql -I/Users/hainingwang/anaconda/include/python2.7 -c _mysql.c -o build/temp.macosx-10.5-x86_64-2.7/_mysql.o -g -fno-omit-frame-pointer -fno-strict-aliasing
In file included from _mysql.c:44:
/usr/local/Cellar/mysql/5.6.24/include/mysql/my_config.h:348:11: warning: 'SIZEOF_SIZE_T' macro redefined [-Wmacro-redefined]
#define SIZEOF_SIZE_T SIZEOF_LONG
^
/Users/hainingwang/anaconda/include/python2.7/pymacconfig.h:43:17: note: previous definition is here
# define SIZEOF_SIZE_T 8
^
In file included from _mysql.c:44:
/usr/local/Cellar/mysql/5.6.24/include/mysql/my_config.h:442:9: warning: 'HAVE_WCSCOLL' macro redefined [-Wmacro-redefined]
#define HAVE_WCSCOLL
^
/Users/hainingwang/anaconda/include/python2.7/pyconfig.h:917:9: note: previous definition is here
#define HAVE_WCSCOLL 1
^
_mysql.c:1589:10: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
if (how < 0 || how >= sizeof(row_converters)) {
~~~ ^ ~
3 warnings generated.
gcc -bundle -undefined dynamic_lookup -L/Users/hainingwang/anaconda/lib -arch x86_64 -arch x86_64 build/temp.macosx-10.5-x86_64-2.7/_mysql.o -L/usr/local/Cellar/mysql/5.6.24/lib -L/Users/hainingwang/anaconda/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.5-x86_64-2.7/_mysql.so
ld: library not found for -lgcc_s.10.5
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/Users/hainingwang/Dropbox/websites/django_projects/CVbuilder/CVbuilder/bin/python -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-CEs0Af/MYSQL-python/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-xUvIl_-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/hainingwang/Dropbox/websites/django_projects/CVbuilder/CVbuilder/include/site/python2.7/MYSQL-python" failed with error code 1 in /private/tmp/pip-build-CEs0Af/MYSQL-python
收集MYSQL-python
下载MySQL-python-1.2.5.zip(108kB)
100% |████████████████████████████████| 110kB 387kB/s
安装收集的软件包:MYSQL-python
运行针对MYSQL python的setup.py安装
从command/Users/hainingwang/Dropbox/websites/django_projects/CVbuilder/CVbuilder/bin/python-c“import setuptools,tokenize;_file uuu='/private/tmp/pip-build-CEs0Af/MYSQL python/setup.py';exec(compile(getattr(tokenize,'open',',open)(__u文件u).read().replace().replace('\r\n','\n'),uu文件,'exec'))”install--record/tmp/pip-xUvIl_--record/install-record.txt--single version外部管理--compile--install headers/Users/hainingwang/Dropbox/websites/django_projects/CVbuilder/CVbuilder/include/site/python2.7/MYSQL-python:
正在运行的安装
运行构建
运行build\u py
创建构建
创建build/lib.macosx-10.5-x86_64-2.7
正在复制_mysql_exceptions.py->build/lib.macosx-10.5-x86_64-2.7
创建build/lib.macosx-10.5-x86_64-2.7/MySQLdb
正在复制MySQLdb/uuu init_uuuu.py->build/lib.macosx-10.5-x86_64-2.7/MySQLdb
正在复制MySQLdb/converters.py->build/lib.macosx-10.5-x86_64-2.7/MySQLdb
正在复制MySQLdb/connections.py->build/lib.macosx-10.5-x86_64-2.7/MySQLdb
正在复制MySQLdb/cursors.py->build/lib.macosx-10.5-x86_64-2.7/MySQLdb
正在复制MySQLdb/release.py->build/lib.macosx-10.5-x86_64-2.7/MySQLdb
正在复制MySQLdb/times.py->build/lib.macosx-10.5-x86_64-2.7/MySQLdb
创建build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants
正在复制MySQLdb/constants/_init__.py->build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants
正在复制MySQLdb/constants/CR.py->build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants
正在复制MySQLdb/constants/FIELD_TYPE.py->build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants
正在复制MySQLdb/constants/ER.py->build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants
正在复制MySQLdb/constants/FLAG.py->build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants
正在复制MySQLdb/constants/REFRESH.py->build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants
正在复制MySQLdb/constants/CLIENT.py->build/lib.macosx-10.5-x86_64-2.7/MySQLdb/constants
运行build_ext
正在生成“\u mysql”扩展
创建构建/临时macosx-10.5-x86_64-2.7
gcc-fno严格别名-I/Users/hainingwang/anaconda/include-arch x86_64-DNDEBUG-g-fwrapv-O3-Wall-Wstrict原型-Dversion_info=(1,2,5,'final',1)-D__=1.2.5-I/usr/local/ceral/mysql/5.6.24/include/mysql-I/Users/hainingwang/anaconda/include/python2.7-c_mysql.c-o build/temp.macosx-10.5-x86_64-2.7/_mysql.o-g-fno省略帧指针-fno严格的别名
在_mysql.c:44中包含的文件中:
/usr/local/cillar/mysql/5.6.24/include/mysql/my_config.h:348:11:警告:“SIZEOF_SIZE_T”宏已重新定义[-Wmacro已重新定义]
#定义SIZEOF_SIZE_T SIZEOF_LONG
^
/Users/hainingwang/anaconda/include/python2.7/pymacconfig.h:43:17:注意:前面的定义在这里
#定义大小\u大小\u T 8
^
在_mysql.c:44中包含的文件中:
/usr/local/cillar/mysql/5.6.24/include/mysql/my_config.h:442:9:警告:“HAVE_WCSCOLL”宏已重新定义[-Wmacro已重新定义]
#定义HAVE_WCSCOLL
^
/Users/hainingwang/anaconda/include/python2.7/pyconfig.h:917:9:注意:前面的定义在这里
#定义HAVE_WCSCOLL 1
^
_mysql.c:1589:10:警告:未签名表达式<0的比较始终为false[-wtautologic compare]
if(how<0 | | how>=sizeof(row|u转换器)){
~~~ ^ ~
生成3个警告。
gcc-bundle-undefined dynamic_lookup-L/Users/hainingwang/anaconda/lib-arch x86_64 build/temp.macosx-10.5-x86_64-2.7/_mysql.o-L/usr/local/cillar/mysql/5.6.24/lib-L/Users/hainingwang/anaconda/lib-lmysqlclient-lsl-lsl-lcrypto build/lib/lib/lib/lib.macosx-10.5-x86-2.7//
ld:找不到用于-lgcc_.10.5的库
叮当声:错误:链接器命令失败,退出代码为1(使用-v查看调用)
错误:命令“gcc”失败,退出状态为1
----------------------------------------
Command“/Users/hainingwang/Dropbox/websites/django_projects/CVbuilder/CVbuilder/bin/python-c”导入setuptools,tokenize;_文件_uuu='/private/tmp/pip-build-CEs0Af/MYSQL-python/setup.py';exec(编译(getattr(tokenize,'open',',open)(_u文件uuu).read().replace().replace('\r\n','n','exec'))“install--record/tmp/pip-xUvIl_--record/install-record.txt--single version externally managed--compile--install headers/Users/hainingwang/Dropbox/websites/django_projects/CVbuilder/CVbuilder/include/site/python2.7/MYSQL python”失败,在/private/tmp/pip-build-CEs0Af/MYSQL python中出现错误代码1
安装将在虚拟环境之外工作
我在OSX 10.10.5上安装了python 2.7.10和Django 1.8.4
谢谢。试着更新最后一个XCode,然后安装命令行工具试着更新最后一个XCode,然后安装命令行工具谢谢你的回答,它确实部分解决了问题。但事实证明,我仍然缺少一些lib,我认为这与我的anaconda有关。所以我只需使用但是使用anaconda是有效的。你可以接受答案并给我一个投票吗?我很感谢你的回答,它确实部分解决了问题。但事实证明,我仍然缺少一些LIB,我认为它与我的anaconda有关。所以我只需安装python而不使用anaconda,它就可以工作。你可以接受答案并给我一票?我很感激