问题
I installed python using the Anaconda installer and am happily using the version of Jupyter that comes with it. I have also downloaded the (32-bit) windows version of pypy and that works fine from the command line.
How can I get CPython Jupyter to use pypy as a kernel when running my python code?
回答1:
Pypy doesn't need a different kernel, it can just use ipykernel. It thus isn't listed separately in the list of Jupyter kernels.
You can use the same methods used for installing kernels for different Python environments to install a kernel for pypy. Eg,
pypy -m pip install ipykernel
pypy -m ipykernel install --user --name pypy --display-name "PyPy"
Or
pypy3 -m pip install ipykernel
pypy3 -m ipykernel install --user --name pypy3 --display-name "PyPy3"
The extra options are just there so that there are useful names for the kernels.
Note, however, that iPython 6 does not support Python 2.7, so if you aren't using PyPy3, you'd need to install iPython 5 in PyPy (I think it should still work with the most recent Jupyter, however).
回答2:
looking through this list (github.com/jupyter/jupyter/wiki/Jupyter-kernels) it doesn't seem like anyone implemented that already, so you might have to put together your own pypy kernel in that case. jupyter-client.readthedocs.io/en/latest/kernels.html
来源:https://stackoverflow.com/questions/44292225/how-to-use-pypy-as-a-kernel-in-cpython-jupyter-in-windows