python 配置开发环境 安装mysql-connector-python

来源:互联网 发布:mysql 存储手机号 编辑:程序博客网 时间:2024/06/06 03:00

Day1:

今天开始跟着廖雪峰老师做一个基于python的博客系统,第一天配置python开发环境;参考网站: 实战;

本机环境: MacOS 10.12

问题: 安装mysql-connector-python中遇到的问题

网上推荐的安装方法: $ easy_install mysql-connector-python, 但是在安装过程中出现了以下问题:

[Errno 13] Permission denied: '/Library/Python/2.7/site-packages/test-easy-install-18192.pth'

以为是权限问题,sudo切换到root权限下进行同样操作,出现一下问题:

Searching for mysql-connector-pythonReading https://pypi.python.org/simple/mysql-connector-python/No local packages or download links found for mysql-connector-pythonerror: Could not find suitable distribution for Requirement.parse('mysql-connector-python')

中间试了下博客Mac平台安装mysql-connector-python中推荐的从git下载相关源码后编译安装,但是仍然失败!

解决办法

最后没办法,选择去mysql-connector-python的下载地下载最新版本的.dmg安装包进行安装,本人安装的版本是: mysql-connector-python-2.1.4-osx10.11.dmg

安装成功测试

~ python>>> import mysql.connector as ms>>> msc.__version__'2.1.4'
0 1