我的Jupyter笔记本电脑有问题。每次我启动笔记本时,内核都会死亡。
因此,我决定使用pip卸载jupyter notebook:
pip uninstall jupyter notebook
Run Code Online (Sandbox Code Playgroud)
成功卸载后,我再次使用相同的点进行安装:
pip install jupyter notebook
Run Code Online (Sandbox Code Playgroud)
然后,像往常一样,我输入cmd:
jupyter notebook
Run Code Online (Sandbox Code Playgroud)
但是得到了这个错误:
'jupyter'无法识别为内部或外部命令,可操作程序或批处理文件。
因此,我检查了IPython的位置,发现现在要调用的正确文件是jupyter-notebook,它与jupyter notebook的破折号不同。如果我从cmd 运行jupyter-notebook,一切正常。
谁能解释,发生了什么事,为什么现在将该文件称为jupyter-notebook?
谢谢
我正在学习Flask并有一个关于在路由上下文中使用变量的问题。例如,我的app.py:
from flask import Flask, render_template
app = Flask(__name__)
@app.route("/index")
def index():
a=3
b=4
c=a+b
return render_template('index.html',c=c)
@app.route("/dif")
def dif():
d=c+a
return render_template('dif.html',d=d)
if __name__ == "__main__":
app.run()
Run Code Online (Sandbox Code Playgroud)
在路由/ dif下,变量d是通过获取已经计算出的c和a的值来计算的。如何在页面之间共享变量c和a,以便计算出变量d并将其呈现给dif.html?
谢谢