简体   繁体   中英

Discord.py not importing (No module named 'mysql')

When I try to import discord, I get the error;

>>> import discord
Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import discord
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/discord/__init__.py", line 20, in <module>
    from .client import Client, AppInfo, ChannelPermissions
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/discord/client.py", line 42, in <module>
    from .voice_client import VoiceClient
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/discord/voice_client.py", line 43, in <module>
    import websockets
  File "/Users/user1/Documents/websockets.py", line 1, in <module>
    import mysql.connector
ModuleNotFoundError: No module named 'mysql'

The details for my python version Python 3.6.1 (v3.6.1:69c0db5050, Mar 21 2017, 01:21:04) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Could there be a file overwriting mysql by any chance?

Looks like a file I made called websockets.py was conflicting with the module. I deleted it and everything works fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM