import discord
import pynacl
client = discord.Client()
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith('$'):
if message.author.voice:
await message.author.voice.channel.connect()
return await message.channel.send(message.author.voice.channel)启动程序后,出现一个错误,即ModuleNotFoundError: No module named 'pynacl'。需要注意的是,pynacl已经在模块列表中。当我重新安装模块pip install PyNaCl/pip3 install PyNaCl时,控制台说模块已经加载了。
尝试:重新加载空闲和计算机,尝试import nacl (ModuleNotFoundError: No module named 'nacl'),而不是import pynacl,重新安装模块,也使用import discrod.py[voice]。如果没有导入模块,它将显示以下错误:RuntimeError: PyNaCl library needed in order to use voice。
我正在使用空闲的Python 3.7.1
发布于 2021-02-22 13:25:23
总之,我想通了。感谢参与讨论这个问题的每一个人。问题是Windows控制台与Python3.6.7版本“绑定”,所有模块都安装在上面,我在3.7.1中工作,因此出现了错误。
固定如下:
launcher".
python3 --version,发现控制台是绑定的。
https://stackoverflow.com/questions/66222729
复制相似问题