gpt4 book ai didi

python-2.7 - iPython 已安装但未找到

转载 作者:行者123 更新时间:2023-12-03 10:10:20 24 4
gpt4 key购买 nike

我最近删除了 Anaconda 并用 brew 重新安装了 python。我已经按照 these 安装了所有东西指示。

Python 工作得很好,到目前为止我测试过的所有包也都可以工作。我已经安装了 ipython,但是尝试从终端启动它会给出:

-bash: ipython: command not found



我在以下位置找到了安装:

/usr/local/lib/python2.7/site-packages/ipython



按照较旧的相关问题,我尝试将此路径添加到 .bash_profile 但得到:

-bash: :/usr/local/lib/python2.7/site-packages/ipython: No such file or directory



每当终端启动。

更多信息:Anaconda 安装了一个已删除的 El-Capitan 10.11.2、python 2.7。

任何帮助将非常感激!

编辑:向@cel 请求添加了更多信息:
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
which -a python给出: /usr/local/bin/python/usr/bin/python .

编辑:添加 python -m pip install ipython 的输出cel的要求:
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"出现了几次点击(包括 this SO question ),但它们并不是特别有用。从它的声音,你有IPython ,安装了 Python 包,但是 ipython ——无论出于何种原因,它的入口点(即包装器/启动器脚本)都不见了。要检查是否是这种情况,请尝试运行:

% 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,那么您可以尝试按照上面链接的 SO 答案的建议创建一个 shell 别名,即,在您的 shell 的启动脚本中放置类似的内容: alias ipython='python -m IPython' .或者,自己创建启动程序脚本。对我来说,它住在 /usr/local/bin/ipython并包含以下内容:
#!/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 问题进行投票……)
更新 :这里有一些更可能相关的链接:
  • ipython: command not found on OSX
  • https://github.com/pypa/pip/issues/426
  • 关于python-2.7 - iPython 已安装但未找到,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34441943/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com