简体   繁体   English

更改修复Mac OSX的路径:-bash:jupyter:命令未找到?

[英]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. SO之前已经解决了这个问题,但是建议的修复程序无效。

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. 我已经通过pip install jupyter --upgrade和macports port install py34-jupyter但是我无法通过命令行访问命令jupyter

When executing pip install jupyter , the message is: 当执行pip install jupyter ,消息为:

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. 这也是pip所在的位置。 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: /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

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. 我认为也许jupyter命令jupyter没有正确的可执行文件路径,但事实并非如此。

How can I have access to jupyter notebook ? 如何获得jupyter notebook

If you are using python on mac, I would strongly recommend using a virtualenv and installing all your dependencies using that. 如果您在Mac上使用python,我强烈建议您使用virtualenv并使用它安装所有依赖项。 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 当您退出虚拟环境时,可以使用pip uninstall jupyter从计算机上pip uninstall jupyter

workon your_virtual_env
pip install jupyter

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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