windows下安装MySQL-python遇到的问题
2024-10-01 01:10:08
执行安装命令
pip install MySQL-python
一、执行时会报一个错误
error: Microsoft Visual C++ 9.0 is required (Unable to find vcvarsall.bat).
Get it from http://aka.ms/vcpython27
解决方法:按提示去上面的网址下载并安装VCForPython27.msi
二、在执行安装命令时还会报错
error: command ‘C:\\Users\\Admin\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe’ failed with exit status 2
解决方法:去 http://www.codegood.com/archives/129 下载执行 MySQL-python-1.2.3.win32-py2.7.exe
三、执行MySQL-python-1.2.3.win32-py2.7.exe时可能会报错:
python version 2.7 required,which was not found in the registry,大致意思是在注册表识别不出python2.7
解决方法:新建一个py文件,复制下面这段代码,执行该文件
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()
执行后会提示:
--- Python 2.7 is now registered!
在执行一次MySQL-python-1.2.3.win32-py2.7.exe,执行成功
执行安装命令:pip install MySQL-python
安装成功
最新文章
- [LeetCode] Restore IP Addresses 复原IP地址
- Snapshot Volume 操作 - 每天5分钟玩转 OpenStack(58)
- vux 中popup 组件 Mask 遮罩在最上层问题的解决
- javascript:history.go()和History.back()的区别(转载)
- 模版(template)
- Server.MapPath()获取绝对路径
- java:继承
- windows平台下VLC2.0.5编译
- 蔡勒(Zeller)公式
- DBA避坑宝典:Oracle运维中的那些事儿
- ToDoList-学习中看到的知识盲点
- VC++编程之字符串解惑--Unicode &; MBCS
- DFB系列 之 Clear清空surface缓存
- C#导入导出Excele数据
- GTK主题黑边问题
- JVM内存划分简介
- 聊聊Servlet、Struts1、Struts2以及SpringMvc中的线程安全
- 集合排序 Comparator和Comparable的使用区别
- pytest的fixture和conftest
- Vue-ui常用组件库整理
热门文章
- UVA - 808 Bee Breeding (建立坐标系&;找规律)
- Linux之awk用法
- 洛谷 4364 [九省联考2018]IIIDX
- 使用Mybatis的逆向工程自动生成代码
- Spring AOP 学习(五)
- nyoj 8 一种排序(用vector,sort,不用set)
- poj 2823 二分法+单调队列
- 利用async和await异步操作解决node.js里面fs模块异步读写,同步结果的问题
- vue.js组件之间的通讯-----父亲向儿子传递数据,儿子接收父亲的数据
- (三)用openCV在图片上绘画标记