Is there a way to use pipenv with Jupyter notebook?

百般思念 提交于 2019-12-29 10:06:05

问题


Is there a way to use pipenv with Jupyter notebook?

Or more specifically, with an atom nteract/hydrogen python 3 kernel?


回答1:


Just tried the following with success.

In your project folder:

pipenv install ipykernel
pipenv shell

This will bring up a terminal in your virtualenv like this:

(my-virtualenv-name) bash-4.4$

In that shell do:

python -m ipykernel install --user --name=my-virtualenv-name

Launch jupyter notebook:

jupyter notebook

In your notebook, Kernel -> Change Kernel. Your kernel should now be an option.

Source: IPythonNotebookVirtualenvs




回答2:


Install and start jupyter inside pipenv:

pipenv install jupyter
pipenv run jupyter notebook

Any other packages that are installed via pipenv (e.g. pipenv install numpy) will also be available to your jupyter notebook session.




回答3:


Luis' answer works perfectly for jupyter notebooks.

But for hydrogen/atom specifically the recipe is:

pipenv install ipykernel
pipenv shell

launch atom from within the pipenv shell

> atom

Should be good to go!



来源:https://stackoverflow.com/questions/47295871/is-there-a-way-to-use-pipenv-with-jupyter-notebook

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!