简体   繁体   English

使用pip安装pygame:命令“python setup.py egg_info”失败,错误代码为1

[英]Installing pygame with pip: Command “python setup.py egg_info” failed with error code 1

I have only recently started to learn programming with python. 我最近才开始用python学习编程。 Currently I am trying to install pygame but I am constantly gettting the same error: 目前我正在尝试安装pygame,但我经常遇到同样的错误:

C:\WINDOWS\system32>python -m pip install pygame
Collecting pygame
Using cached pygame-1.9.2.tar.gz
Complete output from command python setup.py egg_info:


WARNING, No "Setup" File Exists, Running "config.py"
Using WINDOWS configuration...

Path for SDL not found.
Too bad that is a requirement! Hand-fix the "Setup"
Path for FONT not found.
Path for IMAGE not found.
Path for MIXER not found.
Path for PNG not found.
Path for JPEG not found.
Path for PORTMIDI not found.
Path for COPYLIB_tiff not found.
Path for COPYLIB_z not found.
Path for COPYLIB_vorbis not found.
Path for COPYLIB_ogg not found.

If you get compiler errors during install, doublecheck
the compiler flags in the "Setup" file.


Continuing With "setup.py"
Error with the "Setup" file,
perhaps make a clean copy from "Setup.in".
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "c:\users\filip\appdata\local\temp\pip-build-0xsf1b\pygame\setup.py", line 165, in <module>
    extensions = read_setup_file('Setup')
  File "C:\Python33\lib\distutils\extension.py", line 164, in read_setup_file
    line = expand_makefile_vars(line, vars)
  File "C:\Python33\lib\distutils\sysconfig.py", line 430, in expand_makefile_vars
    s = s[0:beg] + vars.get(m.group(1)) + s[end:]
TypeError: Can't convert 'NoneType' object to str implicitly

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:\users\filip\appdata\local\temp\pip-build-0xsf1b\pygame\

I already went through a number of posts with similar problems but none of them had the exactly same issue, and/or they were concerned with different packages and operating systems. 我已经经历了一些有类似问题的帖子,但没有一个有完全相同的问题,和/或他们关心的是不同的软件包和操作系统。 Moreover, I tried a couple of solutions to those problems but nothing worked for me (i tried upgrading pip, installing with easy_install and some other options I, unfortunately, cannot even recall at this point...). 此外,我尝试了几个解决这些问题的解决方案,但没有任何方法适合我(我尝试升级pip,使用easy_install和其他一些选项进行安装我很遗憾,此时甚至无法回想起......)。

I would be sincerely grateful if someone can help me with this problem. 如果有人可以帮我解决这个问题,我将非常感激。 I am aware that it is possibly an irrelevant or "newbie" question, but I honestly tried finding a solution on my own and really have no more clue what to do. 我知道这可能是一个无关紧要或“新手”的问题,但我老老实实地试图找到一个我自己的解决方案,并且真的不知道该怎么做。 I have also never been really educated in computer science, so all of these things frustrate and confuse the hell out of me and constantly get in the way of the learning process (which is hard enough). 我也从未真正接受过计算机科学方面的教育,因此所有这些事情都让我感到沮丧和困惑,并不断妨碍学习过程(这很难)。

I am using Windows 10, python 3.3 64-bit. 我使用的是Windows 10,python 3.3 64位。

Thank you! 谢谢!

Another way to install pygame, which worked for me (W10 64bit, Python 3.4.5). 另一种安装pygame的方法,对我有用(W10 64bit,Python 3.4.5)。

Head here and download the correct pygame wheel file for your version. 到这里下载并为您的版本下载正确的pygame wheel文件。 Then, from cmd, go to the directory the file is in, and type pip install [COMPLETE EXACT FILENAME] . 然后,从cmd,转到该文件所在的目录,并键入pip install [COMPLETE EXACT FILENAME]

Good luck! 祝好运!

我有同样的问题但我通过更新点来解决它

Try upgrading pip . 尝试升级pip Simply open your command line (search cmd in your task bar search box) and enter the command below: 只需打开命令行(在任务栏搜索框中搜索cmd ),然后输入以下命令:

pip install --upgrade pip

Try install pygame from this repository: http://www.lfd.uci.edu/~gohlke/pythonlibs/ 尝试从此存储库安装pygame: http ://www.lfd.uci.edu/~gohlke/pythonlibs/

It is not a official place, but it is trusted. 它不是官方的地方,但它是值得信赖的。 I was having this same problem, and I resolved it installing the package (pygame) from this website. 我遇到了同样的问题,我解决了从这个网站安装软件包(pygame)的问题。 You just have to download the intended".whl" file and install with "pip" from the place where your download is placed. 您只需下载预期的“.whl”文件,并从下载地点的“pip”安装。

Don't forget uninstall the previous Pygame installed. 不要忘记卸载以前安装的Pygame。 =) =)

Check your mysql configuration file using this: 使用以下命令检查您的mysql配置文件:

mysql_config

Now you should get an output something like this: 现在你应该得到这样的输出:

mysql_config 
Usage: /usr/bin/mysql_config [OPTIONS]
Compiler: GNU 6.3.0
Options:
        --cflags         [-I/usr/include/mysql ]
        --cxxflags       [-I/usr/include/mysql ]
        --include        [-I/usr/include/mysql]
        --libs           [-L/usr/lib/x86_64-linux-gnu -lmysqlclient -lpthread -lz -lm -lrt -latomic -ldl]
        --libs_r         [-L/usr/lib/x86_64-linux-gnu -lmysqlclient -lpthread -lz -lm -lrt -latomic -ldl]
        --plugindir      [/usr/lib/mysql/plugin]
        --socket         [/var/run/mysqld/mysqld.sock]
        --port           [0]
        --version        [5.7.18]
        --libmysqld-libs [-L/usr/lib/x86_64-linux-gnu -lmysqld -lpthread -lz -lm -lrt -latomic -lcrypt -ldl -laio -llz4 -lnuma]
        --variable=VAR   VAR is one of:
                pkgincludedir [/usr/include/mysql]
                pkglibdir     [/usr/lib/x86_64-linux-gnu]
                plugindir     [/usr/lib/mysql/plugin]

Ideally it should contain libmysqld-libs option. 理想情况下,它应该包含libmysqld-libs选项。 If it is not there, as it was not there in my case, you can assume that your mysql is broken. 如果不存在,因为在我的情况下不存在,你可以假设你的mysql坏了。

In this case you can write this configuration to config file directly 在这种情况下,您可以直接将此配置写入配置文件

Just downgrade your Python version. 只需降级你的Python版本。 Uninstall your current Python and delete uninstalled python folder, then install python3.5. 卸载当前的Python并删除卸载的python文件夹,然后安装python3.5。

Last, you can use the command line: 最后,您可以使用命令行:

pip3 install pygame

It worked for me. 它对我有用。

暂无
暂无

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

相关问题 通过pip安装时,获取命令“ python setup.py egg_info”失败,错误代码为1 - Getting Command “python setup.py egg_info” failed with error code 1 when installing via pip 无法使用 Python 3.7 的 pip 安装 pygame - 命令“python setup.py egg_info”失败,错误代码为 1 - Can't install pygame with pip for Python 3.7 - Command "python setup.py egg_info" failed with error code 1 返回“命令“ python setup.py egg_info”的Python pip命令失败,错误代码为1” - Python pip command returning 'Command “python setup.py egg_info” failed with error code1' &quot;pip install matplotlib&quot;:&quot;&quot;python setup.py egg_info&quot; failed with error code 1&quot; 安装 matplotlib 时 - "pip install matplotlib":"“python setup.py egg_info” failed with error code 1" while installing matplotlib 无法安装Django:命令“python setup.py egg_info”失败,错误代码1在/ tmp / pip-build-rcF9a5 / Django / - Trouble installing Django: Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-build-rcF9a5/Django/ Python pip安装给出“命令”“ python setup.py egg_info”失败,错误代码为1” - Python pip install gives “Command ”python setup.py egg_info“ failed with error code 1” pip install askbot错误-命令“ python setup.py egg_info”失败,错误代码为1 - pip install askbot error - Command “python setup.py egg_info” failed with error code 1 Pip安装错误-命令python setup.py egg_info失败,错误代码为1 - Pip Installation Error - Command python setup.py egg_info failed with error code 1 pip install iconsdk:命令“ python setup.py egg_info”失败,错误代码为1 - pip install iconsdk: Command “python setup.py egg_info” failed with error code 1 点安装命令“ python setup.py egg_info”失败,错误代码 - Pip install Command “python setup.py egg_info” failed with error code
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM