【发布时间】:2013-11-07 07:47:36
【问题描述】:
我在Windows 7 64-bit 系统上安装了Anaconda 1.6.2,它使用Python 2.7.5。
我需要安装Pygame 1.9.1,这不是conda repository 的一部分。
我无法运行Windows installer,因为Anaconda 没有为Python 创建注册表项,并且.msi 无法识别Python 版本。
所以,我尝试从源代码安装Pygame。我最初想做的是按照这里的说明创建一个 conda 包http://www.continuum.io/blog/conda 根据这些说明,首先从源代码安装包(在这种情况下为 pygame),然后创建一个 conda 包。但是,我在 pygame 安装中失败了。
在运行setup.py 文件("python setup.py install") 时,会引发运行时错误"mingw32: required environment variable MINGW_ROOT_DIRECTORY not set"。
设置环境变量后,我再次运行设置,这次运行时错误变为“依赖项链接到 Python 2.7 的错误 C 运行时”。
错误:
WARNING, DLL for smpeg library not found.
WARNING, DLL for tiff library not found.
WARNING, DLL for SDL_ttf library not found.
WARNING, DLL for SDL_image library not found.
WARNING, DLL for vorbisfile library not found.
WARNING, DLL for jpeg library not found.
WARNING, DLL for vorbis library not found.
WARNING, DLL for SDL_mixer library not found.
WARNING, DLL for png library not found.
WARNING, DLL for SDL library not found.
WARNING, DLL for ogg library not found.
WARNING, DLL for z library not found.
WARNING, DLL for portmidi library not found.
running install
running build
running build_py
running build_ext
Traceback (most recent call last):
File "setup.py", line 491, in <module>
setup(**PACKAGEDATA)
File "C:\Anaconda\lib\distutils\core.py", line 152, in setup
dist.run_commands()
File "C:\Anaconda\lib\distutils\dist.py", line 953, in run_commands
self.run_command(cmd)
File "C:\Anaconda\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Anaconda\lib\distutils\command\install.py", line 563, in run
self.run_command('build')
File "C:\Anaconda\lib\distutils\cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "C:\Anaconda\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Anaconda\lib\distutils\command\build.py", line 127, in run
self.run_command(cmd_name)
File "C:\Anaconda\lib\distutils\cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "C:\Anaconda\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "setup.py", line 352, in run
sys.version_info[:2])
RuntimeError: The dependencies are linked to the wrong C runtime for Python 2.7
\Anaconda\Lib\distutils 中的distutils.cfg 文件读取
[build]
compiler = mingw32
请告诉我安装Pygame with Anaconda 需要做什么。我无法找到有关此组合的任何信息(几乎没有)。我只想补充一点,当我安装 Python 2.7.5 时,Pygame 最初是可以工作的。当我卸载原来的 Python 安装并移至 Anaconda 时,问题出现了。
谢谢!
【问题讨论】:
-
如果您不想在下面搜索最新的答案,并避免过去有效但现在无效的解决方案,只需转到 anaconda 网站上的search results。今天最常用的存储库是this one)。还应避免在非绝对必要时混合使用 conda 和 pip install,因为这会破坏软件包的兼容性。
标签: python python-2.7 pygame anaconda