IPython已安装,但未找到。

3
以下是来自zsh终端的文本,ipython已安装但未找到。需要帮助。无法卸载因为找不到。无法运行因为找不到。但根据bash,它在那里。
➜  green ipython
zsh: command not found: ipython
➜  green ipython3
zsh: command not found: ipython3
➜  green ipython --version
zsh: command not found: ipython
➜  green ipython3 --version
zsh: command not found: ipython3
➜  green pip3 install ipython
Requirement already satisfied: ipython in /home/joshuamwolfe/.local/lib/python3.8/site-packages (7.18.1)
Requirement already satisfied: pexpect>4.3; sys_platform != "win32" in /home/joshuamwolfe/.local/lib/python3.8/site-packages (from ipython) (4.8.0)
Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /home/joshuamwolfe/.local/lib/python3.8/site-packages (from ipython) (3.0.7)
Requirement already satisfied: traitlets>=4.2 in /home/joshuamwolfe/.local/lib/python3.8/site-packages (from ipython) (5.0.4)
Requirement already satisfied: setuptools>=18.5 in /usr/lib/python3/dist-packages (from ipython) (45.2.0)
Requirement already satisfied: decorator in /home/joshuamwolfe/.local/lib/python3.8/site-packages (from ipython) (4.4.2)
Requirement already satisfied: jedi>=0.10 in /home/joshuamwolfe/.local/lib/python3.8/site-packages (from ipython) (0.17.2)
Requirement already satisfied: backcall in /home/joshuamwolfe/.local/lib/python3.8/site-packages (from ipython) (0.2.0)
Requirement already satisfied: pickleshare in /home/joshuamwolfe/.local/lib/python3.8/site-packages (from ipython) (0.7.5)
Requirement already satisfied: pygments in /home/joshuamwolfe/.local/lib/python3.8/site-packages (from ipython) (2.7.1)

更新:

解决方案如下... /摊手

使用以下命令安装ipython:

sudo pip3 install ipython

➜  ~ sudo pip3 install ipython
Collecting ipython
Successfully installed backcall-0.2.0 decorator-4.4.2 ipython-7.18.1 ipython-genutils-0.2.0 jedi-0.17.2 parso-0.7.1 pexpect-4.8.0 pickleshare-0.7.5 prompt-toolkit-3.0.7 ptyprocess-0.6.0 pygments-2.7.1 traitlets-5.0.4 wcwidth-0.2.5
➜  ~ ipython
Python 3.8.2 (default, Jul 16 2020, 14:00:26)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.18.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]:

iPython已安装但找不到

我没有选择上述链接作为解决方案的原因:

  • 主要原因是,% python -m IPython有响应,但zsh认为它未安装。
  • 我使用的是oh my zsh。
  • Parth92提供的+5答案让我感到担忧。

1
  1. 这是zsh而不是bash。
  2. ipython已安装在您的主文件夹中,很可能不在您的PATH中,所以您要么需要卸载它并以root身份重新安装,要么通过显式路径调用它,或者将该文件夹添加到您的PATH中。
- undefined
好的,我来试试看。 - undefined
作为一个新手,在这里最好的选择是什么? - undefined
1
我可能会选择系统范围的安装(sudo pip3 install ipython3),因为你不需要对任何东西进行调整。 - undefined
这个回答解决了你的问题吗?iPython已安装但找不到 - undefined
我看到了那个帖子,但是对其中的全部意思并不完全明白,所以我创建了这个帖子。结果证明,它需要全局安装。最近刚开始使用WSL2。我不记得安装过它。出于某种原因,之前建议进行系统范围安装的几个回复起到了作用。 - undefined
2个回答

2

如果你是初学者,建议全局安装,这样可以减少出错的机会。

sudo pip3 install ipython3

2
在Debian Buster中也是同样的情况,我将~/.local/bin加入到了我的PATH中,它运行得很好。 因此,在使用pip install ipython命令安装ipython后,将这一行添加到您的~/.profile文件中:
export PATH="$PATH:~/.local/bin/"

你可能需要先获取你的.profile文件,但我没有这样做。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接