Error (AttributeError: module 'xxx' has no attribute 'connect') solution

First, the error display

The contents of the red box will be based on importthe package name changes

Here Insert Picture Description

Second, the cause of the error (test package for pymysql, other packages empathy)

  1. One reason (in most cases):

    importThe same package name and file name

    Here Insert Picture Description

  2. Two reasons (few cases):

    File name conflicts with other packages

    Can be seen in the figure below is not an exception, but the errorHere Insert Picture Description

    This is what causes it, click the error content Here Insert Picture Description
    this time to understand, file name conflict with other packagesHere Insert Picture Description

Third, the solution

Currently only solution found to change the file name, and if there are other ways to add welcome message

Welcome attention of the same name micro-channel public number: Program ape Miscellany

Program ape Miscellany

Technology | exchange | welfare
Published 63 original articles · 87 won praise · views 40000 +

Guess you like

Origin blog.csdn.net/weixin_44110998/article/details/102940555