我有 Anaconda 1.6.2
,它使用 Python 2.7.5
,安装在 Windows 7 64 位
系统上。
我需要安装 Pygame 1.9.1
,这不是 conda 存储库
的一部分。
我无法运行 Windows 安装程序
,因为 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"
被抛出。
设置好环境变量后,我再次运行设置,这次运行时错误变为“The dependencies are linked to the wrong C runtime for Python 2.7”。
错误:
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 时,问题出现了。
谢谢!
最佳答案
使用 conda 安装 Python 最简单的方法是:
conda install -c https://conda.binstar.org/krisvanneste pygame
编辑(03/2016):
这个包好像不可用,但是你可以用这个代替:
conda install -c https://conda.anaconda.org/tlatorre python
编辑 (01/2017)
命令变了,现在可以使用了:
conda install -c tlatorre pygame=1.9.2
编辑 (07/2018)
tlatorre 的 repo 仍然有效,但有点过时,如果你想要最新版本,可以使用 cogsci repo:
conda install -c cogsci pygame
关于python - 使用 Anaconda 安装 pygame,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19636480/