更改修复Mac OSX的路径:`-bash:jupyter:command not found`?

时间:2016-12-31 06:46:41

标签: python macos jupyter-notebook jupyter

此问题之前已在SO上讨论过,但建议的修复程序无效。

我已经使用pip install jupyter --upgrade和macports port install py34-jupyter安装了Jupyter但我无法通过命令行访问命令jupyter

执行pip install jupyter时,消息为:

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

这也是pip所在的位置。我也试过

pip uninstall notebook
pip install notebook --upgrade

但这不起作用。

/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages内,我看到了:

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

我想也许命令jupyter可能没有必要的可执行文件的正确路径,但似乎并非如此。

如何才能访问jupyter notebook

1 个答案:

答案 0 :(得分:1)

如果您在mac上使用python,我强烈建议使用virtualenv并使用它安装所有依赖项。有安装和使用多个库的问题。

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

这会创建虚拟环境

deactivate

当您不在虚拟环境中时,可以使用pip uninstall jupyter从您的计算机上卸载jupyter

workon your_virtual_env
pip install jupyter