在IPython中重新加载模块不起作用
我有一个在IPython中重新加载模块不起作用,ipython,jupyter,Ipython,Jupyter,我有一个.ipython\u kernel\u config.py设置,如下所示: c.InteractiveShellApp.extensions = ['autoreload'] c.InteractiveShellApp.exec_lines = ['%autoreload'] # Run these commands on startup c.InteractiveShellApp.exec_lines = [
.ipython\u kernel\u config.py
设置,如下所示:
c.InteractiveShellApp.extensions = ['autoreload']
c.InteractiveShellApp.exec_lines = ['%autoreload']
# Run these commands on startup
c.InteractiveShellApp.exec_lines = [
# imports
"import pandas as pd",
"import numpy as np",
"from scipy import stats",
"import matplotlib.pyplot as plt",
"import statsmodels.api as sm",
"import os",
# Set options
"pd.set_option('display.width', 200)",
"pd.set_option('display.max_rows', 200)",
# Change working directory and import from everything.py
"os.chdir('/home/farasi/py_modules')",
"from everything import *",
# Set variables
"data = '/home/farasi/data/entries.xlsx'",
"results = '/home/farasi/data/results.xlsx'"
]
除了自动重新加载不起作用之外,一切都像.ipython\u kernel\u config.py
文件中设置的那样正常运行。我做错了什么?我在Ubuntu 16.04 32位上使用的是Jupyter
%自动转载
现在自动重新加载所有模块(由%aimport排除的模块除外)
您应该使用%autoreload 2
,它将在需要时重新加载代码。这可能会有帮助: