• 一些python问题


    python 使用mysql,报如下错误

    Python 3.6.8 (v3.6.8:3c6b436a57, Dec 24 2018, 02:04:31) 
    [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import mysql
    Traceback (most recent call last):
      File "", line 1, in <module>
    ModuleNotFoundError: No module named 'mysql'
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    解法

    pip3 install mysql-connector-python-rf
    
    • 1

    Mac 安装符合python版本的pip

    直接easyinstall pip 装的pip和python版本有可能不匹配

    解法

    curl https://bootstrap.pypa.io/pip/get-pip.py -o get-pip.py
    python3 get-pip.py
    
    • 1
    • 2

    Authentication plugin ‘caching_sha2_password’ is not supported

        db = db_util.open_db(args, create_not_exist_db=True)
      File "../../../utils/db_util.py", line 23, in open_db
        db = Database(args.host, args.port, args.user, args.database, pwd, create_not_exist_db)
      File "../../../utils/db_util.py", line 47, in __init__
        create_db(host, port, user, database, pwd)
      File "../../../utils/db_util.py", line 32, in create_db
        password=pwd
      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/mysql/connector/__init__.py", line 179, in connect
        return MySQLConnection(*args, **kwargs)
      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/mysql/connector/connection.py", line 95, in __init__
        self.connect(**kwargs)
      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/mysql/connector/abstracts.py", line 716, in connect
        self._open_connection()
      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/mysql/connector/connection.py", line 210, in _open_connection
        self._ssl)
      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/mysql/connector/connection.py", line 142, in _do_auth
        auth_plugin=self._auth_plugin)
      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/mysql/connector/protocol.py", line 102, in make_auth
        auth_data, ssl_enabled)
      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/mysql/connector/protocol.py", line 58, in _auth_response
        auth = get_auth_plugin(auth_plugin)(
      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/mysql/connector/authentication.py", line 191, in get_auth_plugin
        "Authentication plugin '{0}' is not supported".format(plugin_name))
    mysql.connector.errors.NotSupportedError: Authentication plugin 'caching_sha2_password' is not supported
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24

    解法

    pip install mysql-connector-python
    
    • 1
  • 相关阅读:
    Python配置镜像源
    Hbase数据库安装部署
    大语言模型
    IDEA DeBug 调试工具详解
    从0到一配置单节点zookeeper
    使用Python进行时间序列分析的8种图
    修改git tag的描述信息
    java计算机毕业设计springboot+vue协同过滤算法及在个性化音乐推荐系统
    LeetCode 2240. Number of Ways to Buy Pens and Pencils【数学,枚举;类欧几里得算法】1399
    探索人工智能领域——每日30个名词详解【day3】
  • 原文地址:https://blog.csdn.net/jxhaha/article/details/126022157