如何在 Python 3.4 中使用 pip 安装 Pygame?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31968738/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 10:49:31  来源:igfitidea点击:

How do I install Pygame with pip in Python 3.4?

pythoninstallationpygame

提问by guiraus

I have tried commands like

我尝试过类似的命令

pip install pygame

or

或者

pip install 'Pygame == 1.9.1release' --allow-external Pygame --allow-    unverified Pygame

suggested in other threads but and similars but they don't seem to work for me. Help me, please.

在其他线程中提出了类似的建议,但它们似乎对我不起作用。请帮帮我。

回答by lalilulelost

I did this in Ubuntu and it worked for me with Python 3.4:

我在 Ubuntu 中做了这个,它在 Python 3.4 中对我有用:

I ran a command which apparently upgraded pipand setuptoolsto the latest version, according to this guide in the docs, but did it as a superuser. It might end up not being strictly necessary:

我跑这显然升级了命令pip,并setuptools为最新版本,根据本指南中的文档,但没有它作为一个超级用户。它可能最终不是绝对必要的:

sudo pip install -U pip setuptools

sudo pip install -U pip setuptools

Then, I ran the install command for Pygame as a superuser as well:

然后,我也以超级用户身份运行 Pygame 的安装命令:

sudo pip install pygame

sudo pip install pygame

回答by sameer tzar

In Windows

在 Windows 中

1.open CMD

1.打开CMD

2.Path should locate where pip is installed for me it is C:\Users\qwrht\AppData\Local\Programs\Python\Python36-32\Scripts>

2.Path 应该找到 pip 的安装位置,它是 C:\Users\qwrht\AppData\Local\Programs\Python\Python36-32\Scripts>

if python is in other directory follow steps in link CMD command to change directories

如果 python 在其他目录中,请按照链接CMD 命令中的步骤更改目录

3.getting to the right path where pip is installed use command **pip install pygame.**in CMD

3.进入安装pip的正确路径使用命令**pip install pygame.**in CMD

4.after Downloading pygame current version, Successfully installed pygame message will be displayed as shown

4.下载pygame当前版本后,会显示成功安装pygame的信息 如图所示