草庐IT

EGL_BAD_DISPLAY

全部标签

python - 为什么在制作打印语句时出现 IOError : (9, 'Bad file descriptor' ) 错误?

我在Windows2003服务器上运行python2.5脚本作为服务。对于简单的打印语句,我收到此错误:IOError:(9,'Badfiledescriptor')我删除了所有打印语句,因为它们仅用于开发目的,但我不确定为什么打印语句会导致我出现任何greif。我运行相同的脚本不是作为服务没有任何重大问题。只是想知道其他人是否有任何见解? 最佳答案 您无法打印,因为sys.stdout在不作为控制台session运行时不可用。您可以考虑使用logging模块,而不是使用print语句,这样您就可以设置日志级别并将所有关键内容写入系

python - 为什么在制作打印语句时出现 IOError : (9, 'Bad file descriptor' ) 错误?

我在Windows2003服务器上运行python2.5脚本作为服务。对于简单的打印语句,我收到此错误:IOError:(9,'Badfiledescriptor')我删除了所有打印语句,因为它们仅用于开发目的,但我不确定为什么打印语句会导致我出现任何greif。我运行相同的脚本不是作为服务没有任何重大问题。只是想知道其他人是否有任何见解? 最佳答案 您无法打印,因为sys.stdout在不作为控制台session运行时不可用。您可以考虑使用logging模块,而不是使用print语句,这样您就可以设置日志级别并将所有关键内容写入系

python - tkinter.TclError : couldn't connect to display "localhost:18.0"

我试图在中央服务器中运行模拟(用python编写),模拟完成后,通过连接到我的本地PC将保存的图形文件/保存的数据文件移动到我的本地PC。代码如下:importmatplotlib.pyplotaspltimportsubprocessimportscipy.ioimportos#Savedatafile:scipy.io.savemat(data_path+Filename_str,dict(A=board))#Create/Savefigurebyusingimshow(Heatmap)p=plt.imshow(mean_map.T,cmap=plt.cm.gist_yarg_r,

python - tkinter.TclError : couldn't connect to display "localhost:18.0"

我试图在中央服务器中运行模拟(用python编写),模拟完成后,通过连接到我的本地PC将保存的图形文件/保存的数据文件移动到我的本地PC。代码如下:importmatplotlib.pyplotaspltimportsubprocessimportscipy.ioimportos#Savedatafile:scipy.io.savemat(data_path+Filename_str,dict(A=board))#Create/Savefigurebyusingimshow(Heatmap)p=plt.imshow(mean_map.T,cmap=plt.cm.gist_yarg_r,

python - conda命令会提示错误: "Bad Interpreter: No such file or directory"

我使用的是Archlinux,并且按照Anaconda网站上的说明安装了Anaconda。当我尝试运行condainfo--envs时,出现以下错误:bash:/home/lukasz/anaconda3/bin/conda:/opt/anaconda1anaconda2anaconda3/bin/python:badinterpreter:Nosuchfileordirectory我尝试查找目录/opt/anaconda1anaconda2anaconda3/bin/python:但它根本不存在。此外,当我从终端运行python时,它正常运行,顶部显示以下内容Python3.5.2|

python - conda命令会提示错误: "Bad Interpreter: No such file or directory"

我使用的是Archlinux,并且按照Anaconda网站上的说明安装了Anaconda。当我尝试运行condainfo--envs时,出现以下错误:bash:/home/lukasz/anaconda3/bin/conda:/opt/anaconda1anaconda2anaconda3/bin/python:badinterpreter:Nosuchfileordirectory我尝试查找目录/opt/anaconda1anaconda2anaconda3/bin/python:但它根本不存在。此外,当我从终端运行python时,它正常运行,顶部显示以下内容Python3.5.2|

python - 通过 ssh 使用 tkinter 没有显示名称和没有 $DISPLAY 环境变量

这个问题在这里已经有了答案:GeneratingaPNGwithmatplotlibwhenDISPLAYisundefined(13个回答)关闭8年前。我正在尝试运行一个在集群中输出.png文件的非常简单的代码。代码如下:importmatplotlib.pyplotaspltimportnumpyasnpx=np.random.randn(60)y=np.random.randn(60)plt.scatter(x,y,s=20)out_png='path/to/store/out_file.png'plt.savefig(out_png,dpi=150)如果我在安装了matplot

python - 通过 ssh 使用 tkinter 没有显示名称和没有 $DISPLAY 环境变量

这个问题在这里已经有了答案:GeneratingaPNGwithmatplotlibwhenDISPLAYisundefined(13个回答)关闭8年前。我正在尝试运行一个在集群中输出.png文件的非常简单的代码。代码如下:importmatplotlib.pyplotaspltimportnumpyasnpx=np.random.randn(60)y=np.random.randn(60)plt.scatter(x,y,s=20)out_png='path/to/store/out_file.png'plt.savefig(out_png,dpi=150)如果我在安装了matplot

python - 未定义 DISPLAY 时使用 Matplotlib

这个问题在这里已经有了答案:Howtosaveafigureremotelywithpylab?[duplicate](2个回答)关闭7年前.在远程机器(例如TravisCI)上使用Matplotlib时,我经常遇到与未设置DISPLAY环境变量相关的运行时错误。按照建议,我在测试脚本的开头通过matplotlib.use设置了Agg后端,并确保没有调用show()。尽管如此,我仍然收到以下错误:Traceback(mostrecentcalllast):File"/home/travis/anaconda/envs/testenv/lib/python2.7/site-package

python - 未定义 DISPLAY 时使用 Matplotlib

这个问题在这里已经有了答案:Howtosaveafigureremotelywithpylab?[duplicate](2个回答)关闭7年前.在远程机器(例如TravisCI)上使用Matplotlib时,我经常遇到与未设置DISPLAY环境变量相关的运行时错误。按照建议,我在测试脚本的开头通过matplotlib.use设置了Agg后端,并确保没有调用show()。尽管如此,我仍然收到以下错误:Traceback(mostrecentcalllast):File"/home/travis/anaconda/envs/testenv/lib/python2.7/site-package