python - 使用pip安装后无法运行ipython

标签 python pip ipython

通过 pip 安装后尝试运行 ipython 会导致:

$ ipython
    -bash: ipython: command not found

我需要在路径中添加目录吗? python安装指南没有提到它:

http://ipython.org/install.html

一切似乎都按预期安装:

$ pip show ipython
---
Metadata-Version: 2.0
Name: ipython
Version: 4.0.0
Summary: IPython: Productive Interactive Computing
Home-page: http://ipython.org
Author: The IPython Development Team
Author-email: ipython-dev@scipy.org
License: BSD
Location: /Library/Python/2.7/site-packages
Requires: traitlets, pickleshare, simplegeneric, decorator, gnureadline, appnope, pexpect

我目前在 Mac OS X 10.11 上使用 python 版本 2.7.10

编辑:

我尝试卸载并重新安装,但现在收到此错误:

sudo -H pip install ipython
Collecting ipython
  Downloading ipython-4.0.0-py2-none-any.whl (730kB)
    100% |████████████████████████████████| 733kB 459kB/s 
Requirement already satisfied (use --upgrade to upgrade): traitlets in /Library/Python/2.7/site-packages (from ipython)
Requirement already satisfied (use --upgrade to upgrade): pickleshare in /Library/Python/2.7/site-packages (from ipython)
Requirement already satisfied (use --upgrade to upgrade): simplegeneric>0.8 in /Library/Python/2.7/site-packages (from ipython)
Requirement already satisfied (use --upgrade to upgrade): decorator in /Library/Python/2.7/site-packages (from ipython)
Requirement already satisfied (use --upgrade to upgrade): gnureadline in /Library/Python/2.7/site-packages (from ipython)
Requirement already satisfied (use --upgrade to upgrade): appnope in /Library/Python/2.7/site-packages (from ipython)
Requirement already satisfied (use --upgrade to upgrade): pexpect in /Library/Python/2.7/site-packages (from ipython)
Requirement already satisfied (use --upgrade to upgrade): ipython-genutils in /Library/Python/2.7/site-packages (from traitlets->ipython)
Requirement already satisfied (use --upgrade to upgrade): path.py in /Library/Python/2.7/site-packages (from pickleshare->ipython)
Requirement already satisfied (use --upgrade to upgrade): ptyprocess>=0.5 in /Library/Python/2.7/site-packages (from pexpect->ipython)
Installing collected packages: ipython
Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/basecommand.py", line 211, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/commands/install.py", line 311, in run
    root=options.root_path,
  File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/req/req_set.py", line 646, in install
    **kwargs
  File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/req/req_install.py", line 803, in install
    self.move_wheel_files(self.source_dir, root=root)
  File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/req/req_install.py", line 998, in move_wheel_files
    isolated=self.isolated,
  File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/wheel.py", line 371, in move_wheel_files
    clobber(source, dest, False, fixer=fixer, filter=filter)
  File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/wheel.py", line 310, in clobber
    ensure_dir(destdir)
  File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/utils/__init__.py", line 71, in ensure_dir
    os.makedirs(path)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 150, in makedirs
    makedirs(head, mode)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 150, in makedirs
    makedirs(head, mode)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 1] Operation not permitted: '/System/Library/Frameworks/Python.framework/Versions/2.7/share'

我猜这个错误可能是第一次发生,因为它仍然认为它已经正确安装了!

最佳答案

我也遇到了同样的问题。当您卸载并重新安装 ipython 时,由于权限而发生错误。您可以通过“sudo pip install ipython”删除该目录并重新安装。 我不知道为什么,但它安装在“usr/local/bin”而不是“usr/bin”中。我必须使用“sudo ipython”来运行它。

关于python - 使用pip安装后无法运行ipython,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32974870/

相关文章:

python - 无法导入安装有 `pip install -e .` 的本地包

python - 如何将 .ipynb 文件上传到笔记本云实例?

python - 我应该创建一个我经常使用的函数的 python 模块吗?

python - pip 异常: AttributeError: 'NoneType' object has no attribute 'startswith'

python-3.x - conda 创建环境中的 conda list vs pip list 差异

python - 如何将IPython shell嵌入到使用curses模块的Python程序中?

python - 更改数据帧索引后的 pandas 版本 0.16.0 所有值都变为 NaN

python - yum 安装 firefox 错误 - libnssutil3.so

python - django webfaction : No module named dateutil. relativedelta

python - Suds属性错误: 'NoneType' object has no attribute 'param_defs'