开发者社区> 问答> 正文

python3为什么import pymysql 报错:AttributeErr?400报错

#!/usr/bin/python3
import pymysql.cursors

db = pymysql.connect(
    host = '127.0.0.1',
    port = 3306,
    user = 'root',
    passwd = 'root',
    db = 'li',
    charset = 'utf-8'
)

conn = db.cursor()
sql = """create table page(
          id bigint(7) not null ,
          title varchar(200),
          content vachar(10000),
          created timestamp default current_timestamp ,
          primary key (id)
)
"""
conn.execute(sql)
conn.close()
db.close()

错误提示:

E:\untitled\venv\Scripts\python3.exe E:/untitled/two/mysql_one.py
Traceback (most recent call last):
  File "E:/untitled/two/mysql_one.py", line 2, in <module>
    import pymysql.cursors
  File "E:\untitled\venv\lib\site-packages\pymysql\__init__.py", line 96, in <module>
    from . import connections as _orig_conn
  File "E:\untitled\venv\lib\site-packages\pymysql\connections.py", line 17, in <module>
    from . import _auth
  File "E:\untitled\venv\lib\site-packages\pymysql\_auth.py", line 9, in <module>
    from cryptography.hazmat.primitives import serialization, hashes
  File "E:\untitled\venv\lib\site-packages\cryptography\hazmat\primitives\serialization.py", line 16, in <module>
    from cryptography.hazmat.primitives.asymmetric import dsa, ec, rsa
  File "E:\untitled\venv\lib\site-packages\cryptography\hazmat\primitives\asymmetric\__init__.py", line 12, in <module>
    @six.add_metaclass(abc.ABCMeta)
AttributeError: module 'six' has no attribute 'add_metaclass'

Process finished with exit code 1
 

展开
收起
爱吃鱼的程序员 2020-06-06 15:54:48 1082 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB
                        <p>pip install six</p>
    
                    
    
                            不行诶
                        
    
                        <p>pip3 install six</p>
    
                    
    
                            不行诶,pip后说已经satisfied
                        
    
                        <p>pip install six -U</p>
    
                    
    
                            不行呢,pip不成功
    
    2020-06-06 15:55:07
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
From Python Scikit-Learn to Sc 立即下载
Data Pre-Processing in Python: 立即下载
双剑合璧-Python和大数据计算平台的结合 立即下载