简体   繁体   English

当我尝试通过终端安装 Pygame 时,它​​给了我这个:错误:命令 'gcc' 失败,退出状态为 1

[英]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.

相关问题 当我尝试安装Flask-bcrypt时,抛出错误:命令'x86_64-linux-gnu-gcc'失败,退出状态为1 - when I try to install Flask-bcrypt it throws me error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 尝试安装 OpenDR 时出现错误(命令“gcc”失败,退出状态为 1) - Error (command 'gcc' failed with exit status 1) when trying to install OpenDR python软件包安装给出“错误:命令'gcc'失败,退出状态为1” - python package installation gives “error: command 'gcc' failed with exit status 1” 当我easy_install greenlet我得到“错误:安装脚本退出时出现错误:命令'gcc'失败,退出状态为1” - when i easy_install greenlet i got “error: Setup script exited with error: command 'gcc' failed with exit status 1 ” pip install pyhs2错误:命令“ gcc”失败,退出状态为1 - pip install pyhs2 error: command 'gcc' failed with exit status 1 在Centos 7上安装lxml - 错误:命令'gcc'失败,退出状态为4 - Install lxml on Centos 7 - error: command 'gcc' failed with exit status 4 “Pip install”导致“错误:命令‘gcc’失败,退出状态为 1” - “Pip install” causing “error: command 'gcc' failed with exit status 1” 错误:安装 psycopg2 时命令“gcc”失败并显示退出状态 - Error: command 'gcc' failed with exit status when installing psycopg2 错误:在 Ubuntu 12.04 上安装 pygsl 时,“gcc ...”失败,退出状态为 1 - error: "gcc ... " failed with exit status 1 when I install pygsl on Ubuntu 12.04 错误命令gcc失败,退出状态为1 - error command gcc failed with exit status 1
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM