Question for Python Class 3

  1. 安装flask-mysqldb失败
zhongweideMacBook-Pro:~ ShawnZhong$ sudo pip install flask-mysqldb
Password:
The directory '/Users/ShawnZhong/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/ShawnZhong/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting flask-mysqldb
  Downloading Flask-MySQLdb-0.2.0.tar.gz
Requirement already satisfied (use --upgrade to upgrade): Flask>=0.10 in /Library/Python/2.7/site-packages (from flask-mysqldb)
Collecting mysqlclient (from flask-mysqldb)
  Downloading mysqlclient-1.3.7.tar.gz (79kB)
    100% |████████████████████████████████| 81kB 69kB/s
    Complete output from command python setup.py egg_info:
    sh: mysql_config: command not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/tmp/pip-build-L6g39J/mysqlclient/setup.py", line 17, in <module>
        metadata, options = get_config()
      File "setup_posix.py", line 44, in get_config
        libs = mysql_config("libs_r")
      File "setup_posix.py", line 26, in mysql_config
        raise EnvironmentError("%s not found" % (mysql_config.path,))
    EnvironmentError: mysql_config not found

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-L6g39J/mysqlclient/
You are using pip version 8.1.0, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
zhongweideMacBook-Pro:~ ShawnZhong$ locate mysql_config
/usr/local/mysql-5.7.11-osx10.9-x86_64/bin/mysql_config
/usr/local/mysql-5.7.11-osx10.9-x86_64/bin/mysql_config_editor
/usr/local/mysql-5.7.11-osx10.9-x86_64/man/man1/mysql_config.1
/usr/local/mysql-5.7.11-osx10.9-x86_64/man/man1/mysql_config_editor.1
zhongweideMacBook-Pro:~ ShawnZhong$ export PATH=$PATH:/usr/local/mysql-5.7.11-osx10.9-x86_64/bin
zhongweideMacBook-Pro:~ ShawnZhong$ echo $?
0
zhongweideMacBook-Pro:~ ShawnZhong$ sudo pip install flask-mysqldb
The directory '/Users/ShawnZhong/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/ShawnZhong/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting flask-mysqldb
  Downloading Flask-MySQLdb-0.2.0.tar.gz
Requirement already satisfied (use --upgrade to upgrade): Flask>=0.10 in /Library/Python/2.7/site-packages (from flask-mysqldb)
Collecting mysqlclient (from flask-mysqldb)
  Downloading mysqlclient-1.3.7.tar.gz (79kB)
    100% |████████████████████████████████| 81kB 196kB/s
Requirement already satisfied (use --upgrade to upgrade): click>=2.0 in /Library/Python/2.7/site-packages (from Flask>=0.10->flask-mysqldb)
Requirement already satisfied (use --upgrade to upgrade): itsdangerous>=0.21 in /Library/Python/2.7/site-packages (from Flask>=0.10->flask-mysqldb)
Requirement already satisfied (use --upgrade to upgrade): Werkzeug>=0.7 in /Library/Python/2.7/site-packages (from Flask>=0.10->flask-mysqldb)
Requirement already satisfied (use --upgrade to upgrade): Jinja2>=2.4 in /Library/Python/2.7/site-packages (from Flask>=0.10->flask-mysqldb)
Requirement already satisfied (use --upgrade to upgrade): MarkupSafe in /Library/Python/2.7/site-packages (from Jinja2>=2.4->Flask>=0.10->flask-mysqldb)
Installing collected packages: mysqlclient, flask-mysqldb
  Running setup.py install for mysqlclient ... done
  Running setup.py install for flask-mysqldb ... done
Successfully installed flask-mysqldb-0.2.0 mysqlclient-1.3.7
You are using pip version 8.1.0, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

解决方法:export PATH=$PATH:/usr/local/mysql-5.7.11-osx10.9-x86_64/bin

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值