The python used by Jupyter and local machine are in different place

≡放荡痞女 提交于 2021-02-11 14:14:31

问题


I am new to Jupyter, and I found I can not import module on it. I found the answer said because the Python my Jupyter using is different from the Python my local machine using. This is the output when I run sys.executable on Jupyter:

import sys
sys.executable
'/usr/local/Cellar/jupyterlab/1.2.4/libexec/bin/python3.7'

This is the output on my local machine's terminal

import sys
>>> sys.executable
'/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python'

I have no idea how to fix it, I want to use Jupyter. Any advice may be helpful.

Thank you.


回答1:


I fixed this issue by install Anaconda on my machine, and open the Anaconda app, launch Jupyter. At this time the environment is

'/Users/saber/opt/anaconda3/bin/python'

I think maybe there are 3 versions of Python in my laptop, but I have no idea how to delete them, just keep all of them (hope they do not kill my poor storage 128G).

Reference: Anaconda tutorial Install Anaconda on Mac



来源:https://stackoverflow.com/questions/60311826/the-python-used-by-jupyter-and-local-machine-are-in-different-place

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