[英]When I try to install Pygame through Terminal it gives me this: error: command 'gcc' failed with exit status 1
I have a mac running on Catalina
.我有一台在
Catalina
运行的 mac。 I am very new to python
and using terminal.我对
python
和使用终端很python
。
I have python
installed and I am trying to install Pygame
.我已经安装了
python
并且我正在尝试安装Pygame
。 I was trying to install it through this command:我试图通过这个命令安装它:
-m pip install Pygame==1.9.3
You have to first install pip
by using one of the following:您必须首先使用以下方法之一安装
pip
:
For Python 3对于 Python 3
sudo apt-get install python3-pip
For Python 2对于 Python 2
sudo apt-get install python-pip
Then you have to run python -m pip install pygame==1.9.3
and it should work.然后你必须运行
python -m pip install pygame==1.9.3
它应该可以工作。
I used this command and it worked for me:我使用了这个命令,它对我有用:
python -m pip install pygame
I worked on macOS High Sierra and Windows 10我在 macOS High Sierra 和 Windows 10 上工作过
EDIT: To install pip, go to https://python.org/downloads .编辑:要安装 pip,请访问https://python.org/downloads 。 Then download the latest version of python.
然后下载最新版本的python。 Go through the installation until you get to the page where there is a button that says "customize".
完成安装,直到您到达有一个显示“自定义”按钮的页面。 Click it.
点击它。 A menubar should pop up.
应该会弹出一个菜单栏。 Check the box next to "Install or upgrade pip".
选中“安装或升级 pip”旁边的框。 Then install python.
然后安装python。 Pip should automatically be installed and you should be able to use the command above.
Pip 应该会自动安装,你应该可以使用上面的命令。 Here is a helpful link: https://cs.hofstra.edu/docs/pages/guides/InstallingPygame.html , scroll to where it says "Procedure (Mac OS X)".
这是一个有用的链接: https : //cs.hofstra.edu/docs/pages/guides/InstallingPygame.html ,滚动到“Procedure (Mac OS X)”的位置。
EDIT 2 : The command above is for python2, to install pygame for python3, execute this command in a terminal:编辑2 :上面的命令是针对python2的,要为python3安装pygame,在终端中执行这个命令:
python3 -m pip install pygame
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.