2011-03-12 3 views
18

에 설치하고 Windows x64에 설치하십시오. Python : Windows 7 x64에 mysqldb를 설치하는 방법은 무엇입니까?

나는 (성공적으로 설치 lib 디렉토리에 체크) 파이썬 64, setuptools에를 설치하지만 난 mysqldb를 설치할 수 없습니다. 나는

C를 실행하려고 : 사용자 \ Fedcomp \ 바탕 화면 \ 잎 - 0.4 MySQL을 - 파이썬-1.2.3 \> 파이썬 이

를 설치하지만,이

를 잡을 수있는 setup.py \

In file included from _mysql.c:34: 
D:\servers\xampp_server\xampp\mysql\include/config-win.h:211:1: warning: "finite 
" redefined 
D:\servers\xampp_server\xampp\mysql\include/config-win.h:164:1: warning: this is 
the location of the previous definition 
D:\servers\xampp_server\xampp\mysql\include/config-win.h:277:1: warning: "HAVE_S 
TDDEF_H" redefined 
In file included from D:\Python27\include/Python.h:8, 
       from pymemcompat.h:10, 
       from _mysql.c:29: 
D:\Python27\include/pyconfig.h:673:1: warning: this is the location of the previ 
ous definition 
error: command 'gcc' failed with exit status 1 
또한이 (설치 MS 비주얼 표현)

C:\Users\Fedcomp\Desktop\leaf-0.4\MySQL-python-1.2.3>python setup.py install bui 
ld --compiler=msvc 
running install 
running bdist_egg 
running egg_info 
writing MySQL_python.egg-info\PKG-INFO 
writing top-level names to MySQL_python.egg-info\top_level.txt 
writing dependency_links to MySQL_python.egg-info\dependency_links.txt 
reading manifest file 'MySQL_python.egg-info\SOURCES.txt' 
reading manifest template 'MANIFEST.in' 
warning: no files found matching 'MANIFEST' 
warning: no files found matching 'ChangeLog' 
warning: no files found matching 'GPL' 
writing manifest file 'MySQL_python.egg-info\SOURCES.txt' 
installing library code to build\bdist.win-amd64\egg 
running install_lib 
running build_py 
copying MySQLdb\release.py -> build\lib.win-amd64-2.7\MySQLdb 
running build_ext 
building '_mysql' extension 
error: Unable to find vcvarsall.bat 
,536,913를 MSVC와 노력하지만 잡기

windows x64에서 mysqldb를 올바르게 설치하는 방법은 무엇입니까? (원본 MySQL 설치에서 헤더 XAMPP 서버에 그들이 존재하지 않는 때문에)

또는 누군가가 창문 파이썬 64 또는 파이썬 86에 대한 mysqldb를 컴파일 할 수있다?

답변

35

편집 : mysqlclient에는 PyPI의 32 비트 및 64 비트 바이너리 패키지가 있습니다.

당신은 바이너리 설치 here (파이썬 2.6-3.2)을 찾을 수 here (2.7) 나 : 그것은 2014 년

원래 대답은 후대를 위해 왼쪽부터 릴리스를 보지 않은 MySQL을 - 파이썬의 포크입니다 here (2.6). Windows x64에서 64 비트 Python을 사용할 필요는 없습니다. 파이썬의 32 비트 빌드를 사용할 수도 있습니다.이 빌드에는 타사 패키지가 미리 빌드되어 있습니다.

+0

+1 발견. 나는 32 비트를 사용하라는 제안을지지 할 것이다. 삶이 편해진다. –

+0

다른 버전을 이미 설치 한 경우 먼저 제거하고 올바른 버전을 설치하도록 제안합니다. –

+0

그냥 작은 코멘트 : 첫 번째 링크를 시도하고 내 DB (파이썬 2.7 버전)에 연결하는 데 실패합니다. 그러나 두 번째 링크에서 드라이버가 잘 작동합니다. – dbf

1

"vcvarsall.bat을 찾을 수 없습니다"는 경로에 필요한 Visual Studio 디렉터리가 없다는 것을 의미합니다.

그러나 64 비트 Python을 사용하는 경우 64 비트 컴파일러가 필요하며 Express는 64 비트 버전으로 제공되지 않습니다. SDK MSVC 컴파일러를 다운로드하여 구성 할 수 있지만 매우 어렵습니다.

저는 32 비트 파이썬으로 전환 하겠지만 거의 미리 빌드 된 바이너리를 얻을 수 있습니다.

편집

사전 구축도 간단 할 것 piquadrat에 의해 발견 64 비트 바이너리!

1

나는 100 % 확신 할 수는 없지만 경로 변수가 잘못되었다고 생각합니다. 컴파일러를 찾을 수없는 것, vcvarsall.bat에 대한 검색을 실행하고 두 번 클릭하면 경로 변수를 올바르게 설정해야합니다. 그런 다음 패키지를 다시 설치하십시오. vcvarsall.bat을 찾을 수 없으면 Microsoft Visual Express를 다시 설치하십시오.

+4

미리 컴파일 된 x64 버전의 MySQL-python을 다음 위치에서 사용해보십시오. [Python 확장 패키지 용 비공식 Windows 바이너리] (http://www.lfd.uci.edu/~gohlke/pythonlibs/) –

관련 문제