我在Windows 8 64位操作系统上。运行32位Python 2.7(因为我需要只在此版本上运行的软件包)。我正在尝试从命令promt安装mysql和MySQL。我作为管理员运行cmd。我用:
cd C:/Python27/Scripts
pip install mysql-python
我收到此错误:
Command "C:\Python27\python.exe -c "import setuptools, tokenize;__file__='c:\\us
ers\\troy\\appdata\\local\\temp\\pip-build-yn2u15\\mysql-python\\setup.py';exec(
compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'),
__file__, 'exec'))" install --record c:\users\troy\appdata\local\temp\pip-ohzg7c
-record\install-record.txt --single-version-externally-managed --compile" failed
with error code 1 in c:\users\troy\appdata\local\temp\pip-build-yn2u15\mysql-py
thon
我也尝试使用MySQL-python为mysqldb进行相同的安装,并且有类似的错误消息。下面是错误之前的总输出。请帮我解决这个问题。
C:\Python27\Scripts>pip install mysql-python
You are using pip version 7.0.1, however version 7.1.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting mysql-python
Using cached MySQL-python-1.2.5.zip
Installing collected packages: mysql-python
Running setup.py install for mysql-python
Complete output from command C:\Python27\python.exe -c "import setuptools, t
okenize;__file__='c:\\users\\troy\\appdata\\local\\temp\\pip-build-yn2u15\\mysql
-python\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read()
.replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\troy\appda
ta\local\temp\pip-ohzg7c-record\install-record.txt --single-version-externally-m
anaged --compile:
running install
running build
running build_py
creating build
creating build\lib.win32-2.7
copying _mysql_exceptions.py -> build\lib.win32-2.7
creating build\lib.win32-2.7\MySQLdb
copying MySQLdb\__init__.py -> build\lib.win32-2.7\MySQLdb
copying MySQLdb\converters.py -> build\lib.win32-2.7\MySQLdb
copying MySQLdb\connections.py -> build\lib.win32-2.7\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win32-2.7\MySQLdb
copying MySQLdb\release.py -> build\lib.win32-2.7\MySQLdb
copying MySQLdb\times.py -> build\lib.win32-2.7\MySQLdb
creating build\lib.win32-2.7\MySQLdb\constants
copying MySQLdb\constants\__init__.py -> build\lib.win32-2.7\MySQLdb\constan
ts
copying MySQLdb\constants\CR.py -> build\lib.win32-2.7\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-2.7\MySQLdb\const
ants
copying MySQLdb\constants\ER.py -> build\lib.win32-2.7\MySQLdb\constants
copying MySQLdb\constants\FLAG.py -> build\lib.win32-2.7\MySQLdb\constants
copying MySQLdb\constants\REFRESH.py -> build\lib.win32-2.7\MySQLdb\constant
s
copying MySQLdb\constants\CLIENT.py -> build\lib.win32-2.7\MySQLdb\constants
running build_ext
building '_mysql' extension
error: Microsoft Visual C++ 9.0 is required (Unable to find vcvarsall.bat).
Get it from http://aka.ms/vcpython27
----------------------------------------