gpt4 book ai didi

python - PyCharm中如何让venv访问pygame模块?

转载 作者:太空宇宙 更新时间:2023-11-04 02:31:54 25 4
gpt4 key购买 nike

我正在尝试按照“Python 速成类”一书学习 Python,但我被卡住了,因为这本书没有使用我正在使用的 IDE PyCharm。

我遇到的问题是,当我尝试导入 pygame 时,它​​说 module not found

我使用此命令成功安装了 pygame:

python -m pip install --user pygame

command prompt screenshot

我收到消息“已成功安装 pygame”

但我仍然无法导入它。我注意到 PyCharm 从这个位置使用解释器:\HelloWorld\venv\Scripts\python.exe

在项目文件夹中。

我的 python 安装在:

\AppData\Local\Programs\Python\Python36-32\python.exe

如何让 PyC​​harm 的虚拟环境访问 pygame?

谢谢!

最佳答案

你需要改变你的pycharm项目解释器

找到文件 -> 设置 -> your_project -> 项目解释器

然后选择您已安装所需库的 Venv。

enter image description here

关于python - PyCharm中如何让venv访问pygame模块?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48981913/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com