stata_kernel 的使用

stata_kernel 的使用

虽然很久之前就知道了 stata_kernel 这个插件,这个插件可以让我们能在 Jupyter Notebook 中运行 Stata 代码。

安装

Shell
1
pip3 install stata_kernel

这一步我在安装的时候出现了下面的错误:

Shell
1
Cannot uninstall 'pexpect'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

如果你也出现了这种错误,可以使用下面的语句安装:

Shell
1
sudo pip3 install --ignore-installed stata_kernel

然后安装:

Shell
1
python3 -m stata_kernel.install

如果这一步提示出错:

Shell
1
ImportError: Missing required dependencies ['numpy']

你需要用 conda 安装 numpy:

Shell
1
conda install numpy

接下来安装语法高亮插件:

Shell
1
2
conda install -c conda-forge nodejs -y
jupyter labextension install jupyterlab-stata-highlight

然后就能在 Jupyter notebook 中使用 Stata 了。

使用效果:

绘图效果:

# Stata

Comments

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×