简体   繁体   中英

Changing paths to fix Mac OSX:` -bash: jupyter: command not found`?

This question has been covered previously on SO, but the recommended fixes didn't work.

I have installed Jupyter both with pip install jupyter --upgrade and macports port install py34-jupyter but I cannot access the command jupyter via the command line.

When executing pip install jupyter , the message is:

Requirement already satisfied: jupyter in /opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages

This is also where pip is located. I have also tried

pip uninstall notebook
pip install notebook --upgrade

but this didn't work.

Inside /opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages , I see:

jupyter-1.0.0-py3.4.egg-info
jupyter-1.0.0.dist-info
jupyter.py
jupyter_client
jupyter_client-4.4.0-py3.4.egg-info
jupyter_client-4.4.0.dist-info
jupyter_console
jupyter_console-5.0.0-py3.4.egg-info
jupyter_console-5.0.0.dist-info
jupyter_core
jupyter_core-4.2.0.dist-info
jupyter_core-4.2.1-py3.4.egg-info

I thought perhaps it was possible that the command jupyter does not have the correct path to the executable necessary, but this doesn't appear to be the case.

How can I have access to jupyter notebook ?

If you are using python on mac, I would strongly recommend using a virtualenv and installing all your dependencies using that. Had issues with installing and using several libraries.

pip install virtualenv virtualenvwrapper
# Create a backup of your .bash_profile
cp ~/.bash_profile ~/.bash_profile-org

# Be careful with this command
printf '\n%s\n%s\n%s' '# virtualenv' 'export WORKON_HOME=~/virtualenvs' \
'source /usr/local/bin/virtualenvwrapper.sh' >> ~/.bash_profile

source ~/.bash_profile

mkdir -p $WORKON_HOME

mkvirtualenv your_virtual_env

This creates the virtual environment

deactivate

When you are out of virtual env, you can uninstall jupyter from your machine using pip uninstall jupyter

workon your_virtual_env
pip install jupyter

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM