在我的Django项目中安装My-SQL Python时出错

时间:2017-09-16 08:31:15

标签: python mysql django mysql-python

我是django的新手,我在django环境中安装My-SQL Python时遇到此错误。我尝试了之前发布的大部分答案。当我在cmd上执行“pip install MySQL-python”时,我收到此错误

 error: Microsoft Visual C++ 10.0 is required. Get it with "Microsoft Windows
 SDK 7.1": www.microsoft.com/download/details.aspx?id=8279

,但我已经从链接安装了Windows sdk 7.1和M​​icrosoft Visual C ++ x64Redistributable 10.0,请帮助我。

这就是我得到的

(env) C:\Users\HP\prj\env\plm>pip install MySQL-python
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 ... error
  Complete output from command c:\users\hp\prj\env\scripts\python.exe -u -c "im
ort setuptools, tokenize;__file__='C:\\Users\\HP\\AppData\\Local\\Temp\\pip-bui
d-n_ns79ya\\MySQL-python\\setup.py';f=getattr(tokenize, 'open', open)(__file__)
code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exe
'))" bdist_wheel -d C:\Users\HP\AppData\Local\Temp\tmpbu_gvnsapip-wheel- --pyth
n-tag cp34:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.4
  copying _mysql_exceptions.py -> build\lib.win-amd64-3.4
  creating build\lib.win-amd64-3.4\MySQLdb
  copying MySQLdb\__init__.py -> build\lib.win-amd64-3.4\MySQLdb
  copying MySQLdb\converters.py -> build\lib.win-amd64-3.4\MySQLdb
  copying MySQLdb\connections.py -> build\lib.win-amd64-3.4\MySQLdb
  copying MySQLdb\cursors.py -> build\lib.win-amd64-3.4\MySQLdb
  copying MySQLdb\release.py -> build\lib.win-amd64-3.4\MySQLdb
  copying MySQLdb\times.py -> build\lib.win-amd64-3.4\MySQLdb
  creating build\lib.win-amd64-3.4\MySQLdb\constants
  copying MySQLdb\constants\__init__.py -> build\lib.win-amd64-3.4\MySQLdb\cons
ants
  copying MySQLdb\constants\CR.py -> build\lib.win-amd64-3.4\MySQLdb\constants
  copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win-amd64-3.4\MySQLdb\co
stants
  copying MySQLdb\constants\ER.py -> build\lib.win-amd64-3.4\MySQLdb\constants
  copying MySQLdb\constants\FLAG.py -> build\lib.win-amd64-3.4\MySQLdb\constant

  copying MySQLdb\constants\REFRESH.py -> build\lib.win-amd64-3.4\MySQLdb\const
nts
  copying MySQLdb\constants\CLIENT.py -> build\lib.win-amd64-3.4\MySQLdb\consta
ts
  running build_ext
  building '_mysql' extension
  error: Microsoft Visual C++ 10.0 is required. Get it with "Microsoft Windows
DK 7.1": www.microsoft.com/download/details.aspx?id=8279

  ----------------------------------------
  Failed building wheel for MySQL-python
  Running setup.py clean for MySQL-python
Failed to build MySQL-python
Installing collected packages: MySQL-python
  Running setup.py install for MySQL-python ... error
    Complete output from command c:\users\hp\prj\env\scripts\python.exe -u -c "
mport setuptools, tokenize;__file__='C:\\Users\\HP\\AppData\\Local\\Temp\\pip-b
ild-n_ns79ya\\MySQL-python\\setup.py';f=getattr(tokenize, 'open', open)(__file_
);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'e
ec'))" install --record C:\Users\HP\AppData\Local\Temp\pip-r92d45cb-record\inst
ll-record.txt --single-version-externally-managed --compile --install-headers c
\users\hp\prj\env\include\site\python3.4\MySQL-python:
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.4
    copying _mysql_exceptions.py -> build\lib.win-amd64-3.4
    creating build\lib.win-amd64-3.4\MySQLdb
    copying MySQLdb\__init__.py -> build\lib.win-amd64-3.4\MySQLdb
    copying MySQLdb\converters.py -> build\lib.win-amd64-3.4\MySQLdb
    copying MySQLdb\connections.py -> build\lib.win-amd64-3.4\MySQLdb
    copying MySQLdb\cursors.py -> build\lib.win-amd64-3.4\MySQLdb
    copying MySQLdb\release.py -> build\lib.win-amd64-3.4\MySQLdb
    copying MySQLdb\times.py -> build\lib.win-amd64-3.4\MySQLdb
    creating build\lib.win-amd64-3.4\MySQLdb\constants
    copying MySQLdb\constants\__init__.py -> build\lib.win-amd64-3.4\MySQLdb\co
stants
    copying MySQLdb\constants\CR.py -> build\lib.win-amd64-3.4\MySQLdb\constant

    copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win-amd64-3.4\MySQLdb\
onstants
    copying MySQLdb\constants\ER.py -> build\lib.win-amd64-3.4\MySQLdb\constant

    copying MySQLdb\constants\FLAG.py -> build\lib.win-amd64-3.4\MySQLdb\consta
ts
    copying MySQLdb\constants\REFRESH.py -> build\lib.win-amd64-3.4\MySQLdb\con
tants
    copying MySQLdb\constants\CLIENT.py -> build\lib.win-amd64-3.4\MySQLdb\cons
ants
    running build_ext
    building '_mysql' extension
    error: Microsoft Visual C++ 10.0 is required. Get it with "Microsoft Window
 SDK 7.1": www.microsoft.com/download/details.aspx?id=8279

    ----------------------------------------
Command "c:\users\hp\prj\env\scripts\python.exe -u -c "import setuptools, token
ze;__file__='C:\\Users\\HP\\AppData\\Local\\Temp\\pip-build-n_ns79ya\\MySQL-pyt
on\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace
'\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record
C:\Users\HP\AppData\Local\Temp\pip-r92d45cb-record\install-record.txt --single-
ersion-externally-managed --compile --install-headers c:\users\hp\prj\env\inclu
e\site\python3.4\MySQL-python" failed with error code 1 in C:\Users\HP\AppData\
ocal\Temp\pip-build-n_ns79ya\MySQL-python\

0 个答案:

没有答案