windows pip install MySQL-python
来源:互联网 发布:ubuntu 查看cpu核数 编辑:程序博客网 时间:2024/05/18 00:19
环境,windows64位下,python版本是2.7.11,因为操作数据库需要安装mysql-python,所以直接命令行下,
命令:pip install mysql-python
报错:
_mysql.c(42) : fatal error C1083: Cannot open include file: 'config-win.h': No such 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
下载: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.htmlimport sysfrom _winreg import *# tweak as necessaryversion = sys.version[:3]installpath = sys.prefixregpath = "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位)时,如果选择只为当前用户,以上问题是不会出现的,如果选择所有用户,那就用上面的方法解决吧。
- windows pip install MySQL-python
- pip install MySQL-python error
- centos pip install MySql-python
- windows 下使用python pip install
- venv pip install mysql-python问题
- Pip install on windows
- python 2.6 pip install mysql-python 报错
- 解决Python下pip install MySQL-python失败的问题
- python pip install pil
- Python pip install
- install python-pip
- python pip install
- Python-pip install
- suse install python pip
- python : pip install matplotlib
- python pip install
- Python pip install 加速
- 为Windows安装python的easy install和pip
- [转]DeepLearning(基于caffe)优化策略--Normalization:BN、WN、LN
- Pots
- Xamarin Android读写Contacts联系人
- Qt之信号槽机制
- build.gradle文件详解
- windows pip install MySQL-python
- ie hack
- Mybatis传多个参数(三种解决方案)
- 硬件仿真注意事项
- Android图片加载神器之Fresco,基于各种使用场景的讲解
- 剑指offer题解C++【20】包含min的栈
- RecyclerView
- 字符集编码的简单概述
- HDU 6055 Regular polygon(几何数学)(多校2)