windows pip install MySQL-python
2017-07-28 09:47
435 查看
环境,windows64位下,python版本是2.7.11,因为操作数据库需要安装mysql-python,所以直接命令行下,
报错:
起初以为需要安装VC for python,,,下载后还是不行
后来直接下载源文件mysql for python
命令:python set.py install
还是报错!!!
解决方案:
在这里下载对应文件
http://www.codegood.com/downloads
因为是我 windows64 位 所以MySQL-python-1.2.3.win-amd64-py2.7.exe
其他的在上面链接,按照自己的对应版本下载,双击即可
要想验证一下,可以这样做:
OK!,收工!!
命令:pip install mysql-python
报错:
_mysql.c(42) : fatal error C1083: Cannot open include file: 'config-win.h': No s uch file or directory
error: command 'C:\\Program Files (x86)\\Common Files\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status 2
起初以为需要安装VC for python,,,下载后还是不行
后来直接下载源文件mysql for python
命令:python set.py install
还是报错!!!
解决方案:
在这里下载对应文件
http://www.codegood.com/downloads
因为是我 windows64 位 所以MySQL-python-1.2.3.win-amd64-py2.7.exe
其他的在上面链接,按照自己的对应版本下载,双击即可
要想验证一下,可以这样做:
命令行下>>>import MySQLdb 直接打印>>>print MySQLdb <module 'MySQLdb' from 'C:\Python27\lib\site-packages\MySQLdb\__init__.pyc'>
OK!,收工!!
error: Microsoft Visual C++ 9.0 is required (Unable to find vcvarsall.bat). Get it from http://aka.ms/vcpython27[/code]
下载:Microsoft Visual C++ Compiler for Python 2.7
https://www.microsoft.com/en-gb/download/confirmation.aspx?id=44266
python version 2.7 required,which was not found in the registry
安装PIL-1.1.7.win32-py2.7的时候,不能再注册表中识别出来python2.7
方法:新建一个register.py 文件,把一下代码贴进去,保存# # script to register Python 2.0 or later for use with win32all # and other extensions that require Python registry settings # # written by Joakim Loew for Secret Labs AB / PythonWare # # source: # http://www.pythonware.com/products/works/articles/regpy20.htm # # modified by Valentine Gogichashvili as described in http://www.mail-archive.com/distutils-sig@python.org/msg10512.html import sys from _winreg import * # tweak as necessary version = sys.version[:3] installpath = sys.prefix regpath = "SOFTWARE\\Python\\Pythoncore\\%s\\" % (version) installkey = "InstallPath" pythonkey = "PythonPath" pythonpath = "%s;%s\\Lib\\;%s\\DLLs\\" % ( installpath, installpath, installpath ) def RegisterPy(): try: reg = OpenKey(HKEY_CURRENT_USER, regpath) except EnvironmentError as e: try: reg = CreateKey(HKEY_CURRENT_USER, regpath) SetValue(reg, installkey, REG_SZ, installpath) SetValue(reg, pythonkey, REG_SZ, pythonpath) CloseKey(reg) except: print "*** Unable to register!" return print "--- Python", version, "is now registered!" return if (QueryValue(reg, installkey) == installpath and QueryValue(reg, pythonkey) == pythonpath): CloseKey(reg) print "=== Python", version, "is already registered!" return CloseKey(reg) print "*** Unable to register!" print "*** You probably have another Python installation!" if __name__ == "__main__": RegisterPy()
按F5执行即显示:
显示“python 2.7 is already registered”
再安装setuptools的时候,就能自动识别出来python2.7了。
win7是 64的原因,在安装python(32位)时,如果选择只为当前用户,以上问题是不会出现的,如果选择所有用户,那就用上面的方法解决吧。
相关文章推荐
- 【Python错误】windows下使用pip/easy_install提示Fatal error in launcher: Unable to create process using...
- Windows使用pip安装MySQL-python报错fatal error C1083: Cannot open include file: 'config-win.h'
- pip install MySQL-python 报 "EnvironmentError: mysql_config not found"
- python3.x+windows下pip install 出现unable to find vcvasall.bat 的解决办法
- pip install mysql-connector-python安装时报错
- pip install mysql-connector-python安装时报错不满足requirement
- WIN下解决MySQL-Python模块pip install安装错误
- Windows下python安装easy_install和pip&安装requests和BeautifulSoup库
- pip install mysql-python fails with EnvironmentError: mysql_config not found
- TensorFlow 1.2.0新版本完美支持Python3.6,windows在cmd中输入pip install tensorflow就能下载应用最新tensorflow
- centos pip install MySql-python
- Windows安装Python、pip、easy_install
- pip install mysql-python 提示myql_config not found
- windows 下使用python pip install
- 【Python错误】windows下使用pip/easy_install提示Fatal error in launcher: Unable to create process using...
- Windows下Python、Pydev、easy_install、pip、Numpy、Scipy安装
- pip install MySQL-python error in virtualenv on mac
- mac python 安装mysql(pip install mysql-python)
- python3学习(一) windows下面安装easy_install和pip教程
- Install MySQL 5 for Python 2.6 (and django) on Windows