问题
I get a syntax error when I try to import discord, everything works in vscode but not in cmd
C:\Users\anselm_lothar\Documents\Python\pythonProject\Event bot>main.py Traceback (most recent call last): File "C:\Users\anselm_lothar\Documents\Python\pythonProject\Event bot\main.py", line 4, in import discord File "C:\Users\anselm_lothar\AppData\Local\Programs\Python\Python38\lib\site-packages\discord_init_.py", line 25, in from .client import Client File "C:\Users\anselm_lothar\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\client.py", line 959 """ ^ SyntaxError: (unicode error) \N escapes not supported (can't load unicodedata module)
and my code is just
import discord
回答1:
I first oppened the discord module and changed the code where the error occured, there was an issue with the '\N' not being in a substring,but I also got a new error :/(that had nothing to do with discord module).The _socket module was nowhere to be found so just reinstall python.
来源:https://stackoverflow.com/questions/64491461/i-get-a-syntax-error-when-i-import-discord-in-the-cmd-but-not-in-vs-code