在 EI captain 版本以及以上系统的 Mac 上使用pip
安装 python 相关的包的时候, 由于sip机制
(System Integrity Protection)的不允许命令行写入内容到系统目录, 因此一个比较”优雅”的解决方案就是针对当前用户安装包
1 | pip install jupyter --user your_user_name |
安装完成后, 直接在命令行里输入jupyter notebook
可能会显示jupyter command not found
, 这是由于 pip 安装完 jupyter 后并没有将其加入到 mac 当前运行环境中.
- 先找到 jupyter 安装位置, 通常是在
/Users/neo(your_user_name)/Libraries/Python/2.7/bin
- 将下面命令添加到
~/.bash_profile
中1
export export PATH=/Users/neo/Library/Python/2.7/bin/:$PATH