2017-10-19 299 views
-2

我有一个小问题,我的Discord bot是用Python编写的,而且我不断收到错误。这是我的机器人的代码:''模块“PIP安装期间在Python3.x中找不到”'找不到''

import discord 
import asyncio 

client = discord.Client() 

@client.event 
async def on_ready(): 
    print('Logged in as') 
    print(client.user.name) 
    print(client.user.id) 
    print('------') 

@client.event 
async def on_message(message): 
    if message.content.startswith('!test'): 
     await client.send_message(message.channel, 'Calculating messages...') 

client.run('You arent gonna get my token =D') 

当我运行这个错误出现:

Traceback (most recent call last): 
    File "C:\Users\DELL\Documents\Testing\discordbt.py", line 1, in <module> 
import discord 
ModuleNotFoundError: No module named 'discord' 

我真的不知道该怎么办,我所做的是以下的CMD命令:

pip install discord.py 
pip install asyncio 

这一切,我确信没有错误安装的模块,而他们做到了,什么都在涨而这样的,我知道你需要其他的一些“节目”和我已经安装了以下程序:Python 3.6.3 64xPython 3.7.0a2 64x

我的电脑来自64x位架构,因此它完全匹配。

+0

[Discord PIP Install Error]可能的重复(https://stackoverflow.com/questions/46133128/discord-pip-install-error) – thatrockbottomprogrammer

+2

您确定您的脚本使用了正确的解释器吗?当你安装了几个Python dists时,看到“ModuleNotFound”很常见。 – lotrus28

+0

Interpeter? DIST?向我解释:) @ lotrus28 – DeadlyFirex

回答

1

pip可能会将该模块安装在外部目录中,并将其安装到您使用脚本运行的python版本中。尝试通过将版本号附加到终端命令来指定python版本,如python3.6 -m pip install discord.py。如果这不起作用,请尝试使用pip3而不是pip

编辑:也不要试图安装asyncio,它是标准库的一部分。