简体   繁体   English

Python 3.10 不会导入模块

[英]Python 3.10 won't import modules

I'm working on a basic discord bot in python, so after installing discord.py I start the code with import discord .我正在 python 中开发一个基本的 discord 机器人,所以在安装 discord.py 之后,我使用import discord开始代码。 The discord module is there, and when typing out import discord it will even autofill discord, and trying to install discord again just says that the 'requirement is already satisfied.' The discord module is there, and when typing out import discord it will even autofill discord, and trying to install discord again just says that the 'requirement is already satisfied.' This is the case for both my devices (Windows 10 PC and a Macbook).我的两个设备(Windows 10 PC 和 Macbook)都是这种情况。 When running it on my PC it runs perfectly, but when running it on my macbook I get ModuleNotFoundError: No module named 'Discord' .在我的 PC 上运行它时,它运行得很好,但是在我的 macbook 上运行它时,我得到ModuleNotFoundError: No module named 'Discord' The exact same thing happens with pygame, and probably other modules. pygame 和其他模块也可能发生完全相同的事情。 How can I fix this?我怎样才能解决这个问题?

If you have 2 versions the try py -3.10 -m pip install discord to install in python 3.10.如果您有 2 个版本,请尝试py -3.10 -m pip install discord以安装在 python 3.10 中。 Check the version by pip -V it must be using python 3.9 by default.通过pip -V检查版本,默认情况下必须使用 python 3.9。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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