简体   繁体   中英

-bash: jupyter: command not found

I installed a copy of Anaconda to play around with, but decided I liked Homebrew better, so I removed it. However, this seems to have messed up my install of Jupyter Notebooks, as I can no longer access it. I reinstalled it with pip install jupyter and when I run pip show jupyter I get:

Version: 1.0.0
Summary: Jupyter metapackage. Install all the Jupyter components in one go.
Home-page: http://jupyter.org
Author: Jupyter Development Team
Author-email: jupyter@googlegroups.org
License: BSD
Location: /usr/local/lib/python2.7/site-packages
Requires: ipywidgets, nbconvert, notebook, jupyter-console, qtconsole, ipykernel

But when I run which -a jupyter I get nothing. I even tried uninstalling and installing python again via Homebrew and it still gives me the error, -bash: jupyter: command not found .

I have python installed correctly, which -a python gives:

/usr/local/bin/python
/usr/bin/python

Any ideas as to why it might not be working?

I'm on Mac and am using Zsh. For some reason, after I installed Python3, the following line:

PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}"

was added to .zprofile instead of .zshrc .

I transferred the line to .zshrc and did source ~/.zshrc . That did the trick.

The below command seems to install only python files (under /usr/local/lib/python2.7/site-packages in your case):

pip install jupyter

You can run the jupyter as a Python's module like this:

python -m jupyter

To see all installed modules you can type the following command from the Python's shell:

help('modules')

As an alternative you can try to upgrade the package:

pip install --upgrade pip
pip install --upgrade jupyter

If you want to access the jupyter by simply typing jupyter in your shell then the path to the jupyter's binary file should be placed inside the PATH variable.

During the installation of Anaconda software the jupyter binary is placed under /usr/local/bin/jupyter (Ubuntu 14.04).

On Mac OS Mojave,

pip3 install jupyter

installs jupyter under

/Library/Frameworks/Python.framework/Versions/3.5/bin/

. Your version may be different from 3.5 . You can then link to the binary there as follows.

ln -s /Library/Frameworks/Python.framework/Versions/3.5/bin/jupyter /usr/local/bin/

In the rare case that /usr/local/bin/ is not on your PATH , you may replace it above with some folder that is.

python -m notebook

should do the trick

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