V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
greatchenny
V2EX  ›  Python

anacond3 虚拟环境 django 配置 mysql 一直失败、搞了 5 个小时了 哪个高手远程帮忙看下,奖励一瓶可乐!!!

  •  
  •   greatchenny · 2019-01-15 18:58:08 +08:00 · 1477 次点击
    这是一个创建于 1899 天前的主题,其中的信息可能已经有所发展或是发生改变。
    Traceback (most recent call last):
    File "/Users/wei/anaconda3/envs/shop/lib/python3.6/site-packages/django/db/backends/mysql/base.py", line 15, in <module>
    import MySQLdb as Database
    ModuleNotFoundError: No module named 'MySQLdb'
    6 条回复    2019-01-17 19:28:25 +08:00
    mutou99
        1
    mutou99  
       2019-01-15 19:05:10 +08:00
    项目下的__inin__.py 文件写以下代码,没 pymysql 自行安装
    import pymysql

    pymysql.install_as_MySQLdb()
    suiterchik
        2
    suiterchik  
       2019-01-15 19:21:44 +08:00
    python3 没有 mysqldb,用 pymysql 吧,具体参考楼上
    css3
        3
    css3  
       2019-01-16 09:10:58 +08:00
    @suiterchik 你确定?
    ![1547600982(1).jpg]( )
    greatchenny
        4
    greatchenny  
    OP
       2019-01-17 11:39:35 +08:00
    @mutou99 加 V 信,发红包买可乐
    suiterchik
        5
    suiterchik  
       2019-01-17 15:11:48 +08:00
    @css3 你这个是通过 mysqlclient 之类的安装的 MySQLdb 吧
    python3 支不支持 MySQLdb 上 pypi 查一查不就知道了
    https://pypi.org/project/MySQL-python/#description

    “ MySQL-3.23 through 5.5 and Python-2.4 through 2.7 are currently supported. Python-3.0 will be supported in a future release. PyPy is supported.”
    mutou99
        6
    mutou99  
       2019-01-17 19:28:25 +08:00
    @greatchenny 能解决就行了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3230 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 14:19 · PVG 22:19 · LAX 07:19 · JFK 10:19
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.