幸福

如人饮水,冷暖自知

Mac下ipython安装中的问题及解决方法

安装报错如下:
myroot@lamplife:~$ sudo pip install –user ipython
The directory ‘/Users/myroot/Library/Caches/pip/http’ or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
The directory ‘/Users/myroot/Library/Caches/pip’ or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
Requirement already satisfied: IPython in /Library/Python/2.7/site-packages
Requirement already satisfied: prompt-toolkit<2.0.0,>=1.0.4 in /Library/Python/2.7/site-packages (from IPython)

 

第一步:

关闭“SIP”保护,重启Mac,按住“Command + R”组合键,进到还原模式后,选择实用工具,打开终端,输入命令:“csrutil disable”回车即可,而后重启电脑。

注:安装完毕后,记得重复上述操作开启“SIP”保护, 命令“csrutil enable”

 

第二步:

实用命令:sudo pip install –user IPython  过程如下:

myroot@lamplife:~$ sudo pip install ipython –user -U
The directory ‘/Users/myroot/Library/Caches/pip/http’ or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
The directory ‘/Users/myroot/Library/Caches/pip’ or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
Requirement already up-to-date: ipython in /Library/Python/2.7/site-packages
Requirement already up-to-date: prompt-toolkit<2.0.0,>=1.0.4 in /Library/Python/2.7/site-packages (from ipython)
Requirement already up-to-date: decorator in /Library/Python/2.7/site-packages (from ipython)
Collecting setuptools>=18.5 (from ipython)
Downloading setuptools-38.2.4-py2.py3-none-any.whl (489kB)
100% |████████████████████████████████| 491kB 72kB/s
Requirement already up-to-date: pickleshare in /Library/Python/2.7/site-packages (from ipython)
Requirement already up-to-date: pygments in /Library/Python/2.7/site-packages (from ipython)
Collecting pexpect; sys_platform != “win32” (from ipython)
Downloading pexpect-4.3.1-py2.py3-none-any.whl (55kB)
100% |████████████████████████████████| 61kB 88kB/s
Requirement already up-to-date: pathlib2; python_version == “2.7” or python_version == “3.3” in /Library/Python/2.7/site-packages (from ipython)
Requirement already up-to-date: backports.shutil-get-terminal-size; python_version == “2.7” in /Library/Python/2.7/site-packages (from ipython)
Requirement already up-to-date: simplegeneric>0.8 in /Library/Python/2.7/site-packages (from ipython)
Requirement already up-to-date: traitlets>=4.2 in /Library/Python/2.7/site-packages (from ipython)
Requirement already up-to-date: appnope; sys_platform == “darwin” in /Library/Python/2.7/site-packages (from ipython)
Requirement already up-to-date: six>=1.9.0 in /Library/Python/2.7/site-packages (from prompt-toolkit<2.0.0,>=1.0.4->ipython)
Requirement already up-to-date: wcwidth in /Library/Python/2.7/site-packages (from prompt-toolkit<2.0.0,>=1.0.4->ipython)
Requirement already up-to-date: ptyprocess>=0.5 in /Library/Python/2.7/site-packages (from pexpect; sys_platform != “win32”->ipython)
Requirement already up-to-date: scandir; python_version < “3.5” in /Library/Python/2.7/site-packages (from pathlib2; python_version == “2.7” or python_version == “3.3”->ipython)
Requirement already up-to-date: enum34; python_version == “2.7” in /Library/Python/2.7/site-packages (from traitlets>=4.2->ipython)
Requirement already up-to-date: ipython-genutils in /Library/Python/2.7/site-packages (from traitlets>=4.2->ipython)
Installing collected packages: setuptools, pexpect
Successfully installed pexpect-4.3.1 setuptools-38.2.4
第三步:
上述安装完成,执行如下:

myroot@lamplife:~$ ipython

-bash: ipython: command not found

按如下方式设置别名即可:

myroot@lamplife:~$ alias ipython=’python -m IPython’
ziwen@lamplife:~$ ipython
Python 2.7.10 (default, Feb 7 2017, 00:08:15)
Type “copyright”, “credits” or “license” for more information.

IPython 5.5.0 — An enhanced Interactive Python.
? -> Introduction and overview of IPython’s features.
%quickref -> Quick reference.
help -> Python’s own help system.
object? -> Details about ‘object’, use ‘object??’ for extra details.



去打赏

您的支持将鼓励我们继续创作!

[微信] 扫描二维码打赏

[支付宝] 扫描二维码打赏

点赞

发表评论

电子邮件地址不会被公开。 必填项已用*标注