gpt4 book ai didi

python - 显示无法与 pyvirtualdisplay : "XStartTimeoutError: Failed to start X on display ":100 1"(xdpyinfo check failed)" 一起使用

转载 作者:行者123 更新时间:2023-12-04 16:03:36 25 4
gpt4 key购买 nike

我正在使用 macOS Mojave 并尝试运行以下命令:

import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import optim
import numpy as np
import pandas as pd

import matplotlib.pyplot as plt
import seaborn as sns
from pyvirtualdisplay import Display
from IPython import display as ipythondisplay
from IPython.display import clear_output
from pathlib import Path

import random, os.path, math, glob, csv, base64, itertools, sys
import gym
from gym.wrappers import Monitor
from pprint import pprint

# The following code is will be used to visualize the environments.

def show_video(directory):
html = []
for mp4 in Path(directory).glob("*.mp4"):
video_b64 = base64.b64encode(mp4.read_bytes())
html.append('''<video alt="{}" autoplay
loop controls style="height: 400px;">
<source src="data:video/mp4;base64,{}" type="video/mp4" />
</video>'''.format(mp4, video_b64.decode('ascii')))
ipythondisplay.display(ipythondisplay.HTML(data="<br>".join(html)))

display = Display(visible=0, size=(1400, 900))
display.start();


但是当我尝试运行上述程序时,出现以下错误:
---------------------------------------------------------------------------
XStartTimeoutError Traceback (most recent call last)
<ipython-input-1-73a977c6bd7e> in <module>
31
32 display = Display(visible=0, size=(1400, 900))
---> 33 display.start();
34
35 def make_seed(seed):

/usr/local/lib/python3.7/site-packages/pyvirtualdisplay/abstractdisplay.py in start(self)
166 if not ok:
167 msg = 'Failed to start X on display "%s" (xdpyinfo check failed).'
--> 168 raise XStartTimeoutError(msg % d)
169 return self
170

XStartTimeoutError: Failed to start X on display ":1001" (xdpyinfo check failed).


我得到的唯一接近的是 Why am I getting this message from xauth: “timeout in locking authority file /home//.Xauthority”?

这并不是我在这里真正面对的。我该如何解决这个问题?

最佳答案

我遇到过同样的问题。然后我安装并启动XQuartz这个问题得到了解决。

关于python - 显示无法与 pyvirtualdisplay : "XStartTimeoutError: Failed to start X on display ":100 1"(xdpyinfo check failed)" 一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58100574/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com