2016-09-21 7 views
1

Hey, j'ai essayé d'installer MySQL-Pyhton pendant environ 5 heures maintenant, mais je reçois toujours une erreur. Au début, il était "Impossible de trouver vcvarsall.bat" et quelque chose à propos de moi ayant besoin d'avoir Visual C++ 2010. donc après avoir regardé autour j'ai trouvé une "solution" pour mon problème ... seulement pour recevoir une nouvelle erreur quand je pip installer MySQL-Pyhton. J'utilise python 3.4 avec Pycharm L'installation se fait avec pip sur windows 7.Installation de MySQL-python sous Windows 7

C'est ce que je reçois quand je Pip installer

> Collecting MySQL-python 
    Using cached MySQL-python-1.2.5.zip 
Building wheels for collected packages: MySQL-python 
    Running setup.py bdist_wheel for MySQL-python: started 
    Running setup.py bdist_wheel for MySQL-python: finished with status 'error' 
    Complete output from command C:\Python34\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\yuval\\AppData\\Local\\Temp\\pycharm-packaging0.tmp\\MySQL-python\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d C:\Users\yuval\AppData\Local\Temp\tmp_8v3yxijpip-wheel- --python-tag cp34: 
    running bdist_wheel 
    running build 
    running build_py 
    creating build 
    creating build\lib.win32-3.4 
    copying _mysql_exceptions.py -> build\lib.win32-3.4 
    creating build\lib.win32-3.4\MySQLdb 
    copying MySQLdb\__init__.py -> build\lib.win32-3.4\MySQLdb 
    copying MySQLdb\converters.py -> build\lib.win32-3.4\MySQLdb 
    copying MySQLdb\connections.py -> build\lib.win32-3.4\MySQLdb 
    copying MySQLdb\cursors.py -> build\lib.win32-3.4\MySQLdb 
    copying MySQLdb\release.py -> build\lib.win32-3.4\MySQLdb 
    copying MySQLdb\times.py -> build\lib.win32-3.4\MySQLdb 
    creating build\lib.win32-3.4\MySQLdb\constants 
    copying MySQLdb\constants\__init__.py -> build\lib.win32-3.4\MySQLdb\constants 
    copying MySQLdb\constants\CR.py -> build\lib.win32-3.4\MySQLdb\constants 
    copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-3.4\MySQLdb\constants 
    copying MySQLdb\constants\ER.py -> build\lib.win32-3.4\MySQLdb\constants 
    copying MySQLdb\constants\FLAG.py -> build\lib.win32-3.4\MySQLdb\constants 
    copying MySQLdb\constants\REFRESH.py -> build\lib.win32-3.4\MySQLdb\constants 
    copying MySQLdb\constants\CLIENT.py -> build\lib.win32-3.4\MySQLdb\constants 
    warning: build_py: byte-compiling is disabled, skipping. 

    running build_ext 
    building '_mysql' extension 
    creating build\temp.win32-3.4 
    creating build\temp.win32-3.4\Release 
    C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2\include" -IC:\Python34\include -IC:\Python34\include /Tc_mysql.c /Fobuild\temp.win32-3.4\Release\_mysql.obj /Zl 
    _mysql.c 
    _mysql.c(42) : fatal error C1083: Cannot open include file: 'config-win.h': No such file or directory 
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\BIN\\cl.exe' failed with exit status 2 

    ---------------------------------------- 
    Running setup.py clean for MySQL-python 
Failed to build MySQL-python 
Installing collected packages: MySQL-python 
    Running setup.py install for MySQL-python: started 
    Running setup.py install for MySQL-python: finished with status 'error' 
    Complete output from command C:\Python34\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\yuval\\AppData\\Local\\Temp\\pycharm-packaging0.tmp\\MySQL-python\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\yuval\AppData\Local\Temp\pip-hqm_a4jr-record\install-record.txt --single-version-externally-managed --compile: 
    running install 
    running build 
    running build_py 
    creating build 
    creating build\lib.win32-3.4 
    copying _mysql_exceptions.py -> build\lib.win32-3.4 
    creating build\lib.win32-3.4\MySQLdb 
    copying MySQLdb\__init__.py -> build\lib.win32-3.4\MySQLdb 
    copying MySQLdb\converters.py -> build\lib.win32-3.4\MySQLdb 
    copying MySQLdb\connections.py -> build\lib.win32-3.4\MySQLdb 
    copying MySQLdb\cursors.py -> build\lib.win32-3.4\MySQLdb 
    copying MySQLdb\release.py -> build\lib.win32-3.4\MySQLdb 
    copying MySQLdb\times.py -> build\lib.win32-3.4\MySQLdb 
    creating build\lib.win32-3.4\MySQLdb\constants 
    copying MySQLdb\constants\__init__.py -> build\lib.win32-3.4\MySQLdb\constants 
    copying MySQLdb\constants\CR.py -> build\lib.win32-3.4\MySQLdb\constants 
    copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-3.4\MySQLdb\constants 
    copying MySQLdb\constants\ER.py -> build\lib.win32-3.4\MySQLdb\constants 
    copying MySQLdb\constants\FLAG.py -> build\lib.win32-3.4\MySQLdb\constants 
    copying MySQLdb\constants\REFRESH.py -> build\lib.win32-3.4\MySQLdb\constants 
    copying MySQLdb\constants\CLIENT.py -> build\lib.win32-3.4\MySQLdb\constants 
    warning: build_py: byte-compiling is disabled, skipping. 

    running build_ext 
    building '_mysql' extension 
    creating build\temp.win32-3.4 
    creating build\temp.win32-3.4\Release 
    C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2\include" -IC:\Python34\include -IC:\Python34\include /Tc_mysql.c /Fobuild\temp.win32-3.4\Release\_mysql.obj /Zl 
    _mysql.c 
    _mysql.c(42) : fatal error C1083: Cannot open include file: 'config-win.h': No such file or directory 
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\BIN\\cl.exe' failed with exit status 2 

    ---------------------------------------- 

    Failed building wheel for MySQL-python 
Command "C:\Python34\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\yuval\\AppData\\Local\\Temp\\pycharm-packaging0.tmp\\MySQL-python\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\yuval\AppData\Local\Temp\pip-hqm_a4jr-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\yuval\AppData\Local\Temp\pycharm-packaging0.tmp\MySQL-python\ 

Répondre

0

vous allez vouloir ajouter Python à votre variable d'environnement PATH de cette façon. Aller à:

  1. Poste
  2. Propriétés système
  3. Paramètres système avancés
  4. Sous l'onglet « Avancé » cliquez sur le bouton qui dit « Variables d'environnement »
  5. ensuite sous Variables système vous allez vouloir ajouter/modifier les variables suivantes: PYTHONPATH et Chemin. Voici une pâte de ce que mes variables ressemblent:

PYTHONPATH

C:\Python27;C:\Python27\Lib\site-packages;C:\Python27\Lib;C:\Python27\DLLs;C:\Python27\Lib\lib-tk;C:\Python27\Scripts 

Chemin

C:\Program Files\MySQL\MySQL Utilities 1.3.5\;C:\Python27;C:\Python27\Lib\site-packages;C:\Python27\Lib;C:\Python27\DLLs;C:\Python27\Lib\lib-tk;C:\Python27\Scripts 

de votre chemin peut être différent, donc s'il vous plaît les régler, mais La configuration fonctionne pour moi et vous devriez pouvoir exécuter MySQL après avoir fait ces changements.

+0

bien peu de choses ... d'abord tout ce que je ne peux pas trouver Lib \ lib-tk dans mon python 3.4 dossier aussi je ne peux pas semble trouver C: \ Program Files \ MySQL \ MySQL Utilities 1.3.5 tout était sur mon ordinateur ... – Alex

+0

également changé tous les chemins de python27 à python34 le dossier que j'ai python dans Ce sont mes chemins: pour PYTHONPATH: C:. \ python34; C: \ python34 \ Lib \ site-packages ; C: \ Python34 \ Lib; C: \ Python34 \ DLL; C: \ Python34 \ Scripts Pour le chemin j'ai ajouté ce qui suit: C: \ Program Files \ MySQL \ Utilitaires MySQL 1.3.5 \; C: \ Python34; C: \ Python34 \ Lib \ site -paquets; C: \ Python34 \ Lib; C: \ Python34 \ DLL; C: \ Python34 \ Lib \ lib-tk; C: \ Python34 \ Scripts – Alex