问题
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