Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/342.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 在virtualenv中设置pygame_Python_Pygame_Virtualenv_Sdl - Fatal编程技术网

Python 在virtualenv中设置pygame

Python 在virtualenv中设置pygame,python,pygame,virtualenv,sdl,Python,Pygame,Virtualenv,Sdl,我正在尝试在python virtualenv中设置pygame,以便可以使用pygames Directinputs读取控制器数据。我在windows 10上使用开发者命令行(基本上是安装在windows系统上的bash)。我已经安装了pygame,但是我得到了错误:pygame.error:没有可用的视频设备 ALSA lib confmisc.c:768:(parse_card) cannot find card '0' ALSA lib conf.c:4292:(_snd_config_

我正在尝试在python virtualenv中设置pygame,以便可以使用pygames Directinputs读取控制器数据。我在windows 10上使用开发者命令行(基本上是安装在windows系统上的bash)。我已经安装了pygame,但是我得到了错误:pygame.error:没有可用的视频设备

ALSA lib confmisc.c:768:(parse_card) cannot find card '0'
ALSA lib conf.c:4292:(_snd_config_evaluate) function snd_func_card_driver 
returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4292:(_snd_config_evaluate) function snd_func_concat 
returned error: No such file or directory
ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name
ALSA lib conf.c:4292:(_snd_config_evaluate) function snd_func_refer returned 
error: No such file or directory
ALSA lib conf.c:4771:(snd_config_expand) Evaluate error: No such file or 
directory
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM default
Traceback (most recent call last):
File "Controller.py", line 36, in <module>
screen = pygame.display.set_mode(size)
pygame.error: No available video device

和其他SDL_VIDEODRIVER标志,但它们似乎都没有改变任何东西。关于如何让代码工作,有什么建议吗?我的代码只是pygames操纵杆对象的示例程序,因此,如果您需要参考,它就是。

修复了复制可复制性。在win10上运行bash的方法有很多,但听起来像是从安装在windows linux子系统中的ubuntu上运行bash。如果Pygame不理解该环境中的窗口/图形堆栈,我并不感到惊讶。从dos安装时,您的运气会更好。
import os
os.environ["SDL_VIDEODRIVER"] = "directx"