2017-09-17 19 views
0

任何人都繞過以下Bokeh值錯誤。任何快速解決?散焦值錯誤

File "C:\ProgramData\Anaconda3\lib\site-packages\bokeh\resources.py", line 218, in __init__ 
      "'inline', 'cdn', 'server(-dev)', 'relative(-dev)' or 'absolute(-dev)', got %r" % self.mode) 

ValueError: wrong value for 'mode' parameter, expected 'inline', 'cdn', 'server(-dev)', 'relative(-dev)' or 'absolute(-dev)', got 'BOKEH_RESOURCES=inline' 

Python代碼我使用在下面給出,

from bokeh.plotting import figure, show, output_file 

from bokeh.resources import CDN 

from bokeh.embed import file_html 

x = elastic_Rest_y_disp 
A = figure(title="Wing Station vs Shear Force along y direction",y_range=(500,38000),plot_width=900, plot_height=700,toolbar_location="left",toolbar_sticky=False) 

A.xaxis.axis_label = "Wing Station" 

A.yaxis.axis_label = "Force (lbs)" 

A.line(x, elastic_Rest_CY, legend="elastic_Rest_CY",line_color="black", line_dash=[4, 4],line_width=2) 
A.square(x, elastic_Rest_CY, legend="elastic_Rest_CY", fill_color=None, line_color="green") 

A.legend.location = "top_right"  

output_file("GFEM_vs_CB_elastic_y.html",**mode="inline"**, title="Wing Station vs Shear Force along y direction") 

show(A) 
+0

哪裏的代碼,你在呼喚背景虛化?不要忘記包含一個最小完整的可驗證示例:https://stackoverflow.com/help/mcve –

回答

1

BOKEH_RESOURCES環境變量。這是一種在運行腳本時從命令行指定資源覆蓋的方法。在Linux系統上,你運行像:

BOKEH_RESOURCES=inline python myscript.py 

傳爲Python代碼的參數(這是你看起來是在做)。

我相信在Windows上,你會怎麼做:

set BOKEH_RESOURCES=inline 

然後

python myscript.py 
+0

謝謝你的答案。我通過spyder GUI運行python程序,那麼我如何在Spyder中設置它? –

+0

Spyder在運行腳本時可能有一個配置選項來設置env vars,我不知道(我不使用Spyder)。否則,如果您在腳本中使用'output_file',那麼您可以在腳本中交替地將'mode =「inline」'傳遞給'output_file',而不是使用env var。 – bigreddot

+0

我已經看到「BOKEH_RESOURCES = inline」已經存在於我的環境變量(窗口)中。在這種情況下,我們不需要每次運行python代碼就給它。另外我嘗試在python腳本中向output_file添加mode =「inline」,但存在相同的錯誤。我試過python,它工作。我只是想以某種方式在Windows中做這個。任何幫助? –