已安装iPython但未找到 [英] iPython installed but not found
问题描述
我最近删除了Anaconda并用brew重新安装了python。我根据这些说明。
I've recently deleted Anaconda and reinstalled python with brew. I've installed everything according to these instructions.
Python效果很好,到目前为止我测试的所有软件包都可以使用。我已经安装了ipython,但尝试从终端启动它给出:
Python works great, and all packages I've tested so far also work. I've got ipython installed, but trying to launch it from the terminal gives:
-bash:ipython:command not found
-bash: ipython: command not found
我找到了安装位置:
/usr/local/lib/python2.7/site-packages/ipython
/usr/local/lib/python2.7/site-packages/ipython
关于较早的相关问题,我试过添加这个.bash_profile的路径但得到:
Following older related questions, I've tried adding this path to .bash_profile but got:
-bash :: /usr/local/lib/python2.7/site-packages/ipython:没有这样的文件或目录
-bash: :/usr/local/lib/python2.7/site-packages/ipython: No such file or directory
每当终端开始时。
更多信息:Anaconda安装了一个删除的El-Capitan 10.11.2,python 2.7。
Some more info: Anaconda installed an removed, El-Capitan 10.11.2, python 2.7.
任何帮助都将不胜感激!
Any help would be much appreciated!
编辑:向@cel请求添加了更多信息:
added some more info to @cel request:
echo $ PATH
给出:
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/git/bin:/Library/TeX/texbin:/Applications/Sublime Text.app/Contents/SharedSupport/bin
其中-a python
给出:
/ usr / local / bin / python
和 / usr / bin / python
。
编辑:添加 python -m pip install ipython
的输出到cel的请求:
added the output of python -m pip install ipython
to cel's request:
Requirement already satisfied (use --upgrade to upgrade): ipython in /usr/local/lib/python2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): traitlets in /usr/local/lib/python2.7/site-packages (from ipython)
Requirement already satisfied (use --upgrade to upgrade): pickleshare in /usr/local/lib/python2.7/site-packages (from ipython)
Requirement already satisfied (use --upgrade to upgrade): simplegeneric>0.8 in /usr/local/lib/python2.7/site-packages (from ipython)
Requirement already satisfied (use --upgrade to upgrade): decorator in /usr/local/lib/python2.7/site-packages (from ipython)
Requirement already satisfied (use --upgrade to upgrade): gnureadline in /usr/local/lib/python2.7/site-packages (from ipython)
Requirement already satisfied (use --upgrade to upgrade): appnope in /usr/local/lib/python2.7/site-packages (from ipython)
Requirement already satisfied (use --upgrade to upgrade): pexpect in /usr/local/lib/python2.7/site-packages (from ipython)
Requirement already satisfied (use --upgrade to upgrade): ipython-genutils in /usr/local/lib/python2.7/site-packages (from traitlets->ipython)
Requirement already satisfied (use --upgrade to upgrade): path.py in /usr/local/lib/python2.7/site-packages (from pickleshare->ipython)
Requirement already satisfied (use --upgrade to upgrade): ptyprocess>=0.5 in /usr/local/lib/python2.7/site-packages (from pexpect->ipython)
推荐答案
在网上搜索bash:ipython:command not found
出现了几次点击(包括这个问题),但它们并没有特别有用。从它的声音,你有 IPython
,安装了Python 包,但是 ipython
- 它的包装/发射器 - 因任何原因而丢失。要检查是否是这种情况,请尝试运行:
Searching the web for "bash: ipython: command not found"
turns up several hits (including this SO question), but they're not particularly helpful. From the sound of it, you have IPython
, the Python package installed, but ipython
—the wrapper/launcher for it—is missing for whatever reason. To check whether this is the case, try running:
% python -m IPython
Python 2.7.9 (default, Feb 10 2015, 03:28:08)
Type "copyright", "credits" or "license" for more information.
IPython 4.0.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.
In [1]:
如果这会带来IPython,那么你可能会尝试制作一个shell别名,因为上面链接的SO答案表明,即在shell的启动脚本中输入类似的内容: alias ipython ='python -m IPython'
。或者,自己创建启动器脚本。对我来说,它存在于 / usr / local / bin / ipython
中,并包含以下内容:
If that brings up IPython, then you might try making a shell alias as the SO answer linked above suggests, i.e., put something like this in your shell's startup script: alias ipython='python -m IPython'
. Or, create the launcher script yourself. For me, it lives in /usr/local/bin/ipython
and contains the following:
#!/usr/local/opt/python/bin/python2.7
# -*- coding: utf-8 -*-
import re
import sys
from IPython import start_ipython
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(start_ipython())
希望这会有所帮助。 (如果确实如此,请考虑对其他SO 问题进行投票 ......)
Hope this helps. (If it does, please consider up-voting the other SO question as well...)
更新 :以下是一些可能相关的链接:
UPDATE: Here are some more possibly-relevant links:
- ipython: command not found on OSX
- https://github.com/pypa/pip/issues/426
这篇关于已安装iPython但未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!