AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题

问题[ipython](ubuntu)

Martin Hope
sumer fattoum
Asked: 2020-12-17 15:24:41 +0800 CST

从终端运行时,ipython 显示无效语法

  • 0

我使用 python 3.7,但也安装了 3.6 和 2.7,我使用的是 Ubuntu 16.04 LTS。

我将 python 的顺序更改为 python 2.7 仍然无法正常工作,我在 VMware 上使用它。我想我对 python3 进行了更改,我安装了很多包。

我正在尝试运行 jupyter notebook,但我无法弄清楚可能导致问题的原因。

当我尝试从终端运行 ipython 时,它显示:

stealth@ubuntu:~/Desktop$ ipython
Traceback (most recent call last):
  File "/home/stealth/.local/bin/ipython", line 7, in <module>
    from IPython import start_ipython
  File "/home/stealth/.local/lib/python3.7/site-packages/IPython/__init__.py", line 55, in <module>
    from .core.application import Application
  File "/home/stealth/.local/lib/python3.7/site-packages/IPython/core/application.py", line 25, in <module>
    from IPython.core import release, crashhandler
  File "/home/stealth/.local/lib/python3.7/site-packages/IPython/core/crashhandler.py", line 27, in <module>
    from IPython.core import ultratb
  File "/home/stealth/.local/lib/python3.7/site-packages/IPython/core/ultratb.py", line 116, in <module>
    from IPython.utils import path as util_path
  File "/home/stealth/.local/lib/python3.7/site-packages/IPython/utils/path.py", line 17, in <module>
    from IPython.utils.process import system
  File "/home/stealth/.local/lib/python3.7/site-packages/IPython/utils/process.py", line 19, in <module>
    from ._process_posix import system, getoutput, arg_split, check_pid
  File "/home/stealth/.local/lib/python3.7/site-packages/IPython/utils/_process_posix.py", line 23, in <module>
    import pexpect
  File "/usr/lib/python3/dist-packages/pexpect/__init__.py", line 75, in <module>
    from .pty_spawn import spawn, spawnu
  File "/usr/lib/python3/dist-packages/pexpect/pty_spawn.py", line 15, in <module>
    from .spawnbase import SpawnBase
  File "/usr/lib/python3/dist-packages/pexpect/spawnbase.py", line 218
    def expect(self, pattern, timeout=-1, searchwindowsize=-1, async=False):
                                                                   ^
SyntaxError: invalid syntax
python ipython syntax
  • 1 个回答
  • 1130 Views
Martin Hope
Icetroid
Asked: 2020-12-09 00:10:31 +0800 CST

“E:包'ipython'没有安装候选”,同时尝试安装火炬

  • 1

我正在尝试在 Ubuntu 20.04.1 LTS 上安装 Torch http://torch.ch/docs/getting-started.html
当我运行时

cd ~/torch; bash install-deps;

它会产生此错误:

Package ipython is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'ipython' has no installation candidate

如何安装 ipython?

software-installation apt ipython
  • 3 个回答
  • 4122 Views
Martin Hope
daniel blanco
Asked: 2019-06-14 00:05:28 +0800 CST

Ipython Magic - 无法安装 Ubuntu Server 18.04

  • 0

我已经清楚地遵循了这里的说明https://ipython.readthedocs.io/en/stable/install/install.html#dependencies

在下面运行这些命令。

pip3 install ipython
pip3 show ipython
pip3 install pexpect jedi pygments setuptools decorator prompt-toolkit pickleshare backcall traitlets

我仍然收到此错误

>>> %precision 2
  File "<stdin>", line 1
    %precision 2
    ^
SyntaxError: invalid syntax

提前感谢您的帮助

python ipython
  • 1 个回答
  • 83 Views
Martin Hope
Stefan
Asked: 2018-12-19 05:47:26 +0800 CST

运行 PtPython 时出现“ImportError:无法导入名称 PathCompleter”

  • 3

我想使用 ptipython 来运行 Web 驱动程序。

所以我首先使用pip install ipython, 和 ptipython 以相同的方式安装了 iPython。我在使用提示工具包版本时遇到了一些问题,但我以某种方式解决了它们。

现在,当我运行 ipython 时,它开始时没有问题,但是当我运行 ptipython 时,这是我得到的错误:

Traceback (most recent call last):
  File "/usr/local/bin/ptipython", line 11, in <module>
    sys.exit(run())
  File "/usr/local/lib/python2.7/dist-packages/ptpython/entry_points/run_ptipython.py", line 41, in run
    from ptpython.ipython import embed
  File "/usr/local/lib/python2.7/dist-packages/ptpython/ipython.py", line 14, in <module>
    from prompt_toolkit.completion import PathCompleter, WordCompleter
ImportError: cannot import name PathCompleter

我怎样才能解决这个问题?

python ipython 18.10
  • 2 个回答
  • 1508 Views
Martin Hope
Sheng Bi
Asked: 2018-10-04 19:40:07 +0800 CST

如何更改我的 jupyter notebook 工作目录?

  • 3

我想更改我的 jupyter notebook 工作目录,我应该如何进行?

如果可能的话,我还想保留当前的工作目录。

ipython jupyter
  • 1 个回答
  • 6594 Views
Martin Hope
gl3yn
Asked: 2018-05-28 00:07:07 +0800 CST

在终端中打开的 iPython3 - os.path.dir 将字母 'd' 添加到路径并触发 File not found 错误

  • 1

试图遍历一个文件夹。我正在研究 ipython3,在终端中打开。这是代码(在 python 3.6.4 中):

for filename in os.listdir('.'):
    for file in filename:
       with open(os.path.join('.',file), 'r') as f:
            print(len(f))

但是我得到这个错误。

FileNotFoundError                         Traceback (most recent call last)
<ipython-input-6-1702c8aca957> in <module>()
  1 for filename in os.listdir('.'):
  2     for file in filename:
----> 3         with open(os.path.join('.',file), 'r') as f:
  4             print(len(f))
  5 

FileNotFoundError: [Errno 2] No such file or directory: './d'

路径中添加了“d”,但找不到目录。Jupypter QtConsole 也是如此。

command-line paths python3 ipython
  • 1 个回答
  • 70 Views
Martin Hope
Daniel W.
Asked: 2018-02-02 15:05:04 +0800 CST

iPython 在 Python 3 而不是 Python 2 上运行

  • 1

我已经通过 pip 安装了 iPython。但是,它在 Python 3 上运行。如何让我的系统区分 iPython 和 iPython3?我希望 iPython 在 Python 2 上运行。

ipython
  • 2 个回答
  • 1342 Views
Martin Hope
Imran
Asked: 2017-06-20 07:41:22 +0800 CST

IPython错误执行系统命令

  • 1

如果我在我的 Ubuntu 16.04 机器上的 ipython2/3 中执行任何系统命令,我会收到权限被拒绝错误,如下所示:

In [1]: ls
--------------------------------------------------------------------------
PermissionError                           Traceback (most recent call last)
<ipython-input-1-5b21b94dda0e> in <module>()
----> 1 get_ipython().magic('ls ')

我不需要在 Ubuntu 14.04 中做任何特别的事情。我已经安装了 ipython2 和 ipython3

pip2 install ipython --user
pip3 install ipython --user

sudo我还尝试使用as在系统范围内安装它

sudo pip2 install ipython
sudo pip3 install ipython

但问题仍然存在。我在 jupyter notebook 中没有遇到这个问题。

如何在 IPython 中使用系统命令?

ipython
  • 2 个回答
  • 137 Views
Martin Hope
Ralf Rafael Frix
Asked: 2016-07-16 10:50:06 +0800 CST

在 Spyder 中看不到 IPython 控制台

  • 1

我最近使用以下命令在我的 Ubuntu 14.04 中安装了 IPython

sudo apt-get install spyder

我的问题是我不能使用 IPython 控制台:

在此处输入图像描述

我所看到的只是 Spyder 右下角的一个灰色空白区域。我怎样才能解决这个问题?

更新:

  1. ipython-qtconsole已安装在我的系统中,因此它不是导致问题的原因。

在此处输入图像描述

  1. python-zmq也已经安装了。

在此处输入图像描述

ipython
  • 1 个回答
  • 2919 Views
Martin Hope
Wanderer
Asked: 2016-04-18 19:09:50 +0800 CST

Ubuntu中的Scala构建工具错误[重复]

  • 0
这个问题在这里已经有了答案:
如何从我的 sources.list 中删除格式错误的行? (9 个回答)
4年前关闭。

我在我的 Ubuntu 12.04 中安装了 Apache spark(1.5.2) 和 IPython(0.12.1) 笔记本。在专门为 PySpark 创建 IPython 配置文件之前,我想安装 scala 构建工具。我按照以下查询来构建 sbt。

wget http://apt.typesafe.com/repo-deb-build-0002.deb `

#Install the repository
sudo dpkg -i repo-deb-build-0002.deb

#Refresh
sudo apt-get update

运行 apt-get update 时出现以下错误。

user@user-VirtualBox:~/spark$ sudo apt-get update
E: Malformed line 2 in source list /etc/apt/sources.list.d/sbt.list (dist)
E: The list of sources could not be read.

我在网上搜索以解决此问题。根据网上的说明,问题出在第 2 行,我评论了第 2 行,即

# deb http://in.archive.ubuntu.com/ubuntu/ precise main restricted
deb-src http://in.archive.ubuntu.com/ubuntu/ precise main restricted

下面是/etc/apt/sources.list的实际输出

$ cat /etc/apt/sources.list

# deb cdrom:[Ubuntu 12.04.4 LTS _Precise Pangolin_ - Release amd64 (20140204)]/ dists/precise/main/binary-i386/
# deb cdrom:[Ubuntu 12.04.4 LTS _Precise Pangolin_ - Release amd64 (20140204)]/ dists/precise/restricted/binary-i386/
# deb cdrom:[Ubuntu 12.04.4 LTS _Precise Pangolin_ - Release amd64 (20140204)]/ precise main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://in.archive.ubuntu.com/ubuntu/ precise main restricted
deb-src http://in.archive.ubuntu.com/ubuntu/ precise main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://in.archive.ubuntu.com/ubuntu/ precise-updates main restricted
deb-src http://in.archive.ubuntu.com/ubuntu/ precise-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://in.archive.ubuntu.com/ubuntu/ precise universe
deb-src http://in.archive.ubuntu.com/ubuntu/ precise universe
deb http://in.archive.ubuntu.com/ubuntu/ precise-updates universe
deb-src http://in.archive.ubuntu.com/ubuntu/ precise-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
## team, and may not be under a free licence. Please satisfy yourself as to 
## your rights to use the software. Also, please note that software in 
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://in.archive.ubuntu.com/ubuntu/ precise multiverse
deb-src http://in.archive.ubuntu.com/ubuntu/ precise multiverse
deb http://in.archive.ubuntu.com/ubuntu/ precise-updates multiverse
deb-src http://in.archive.ubuntu.com/ubuntu/ precise-updates multiverse
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://in.archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://in.archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu precise-security main restricted
deb-src http://security.ubuntu.com/ubuntu precise-security main restricted
deb http://security.ubuntu.com/ubuntu precise-security universe
deb-src http://security.ubuntu.com/ubuntu precise-security universe
deb http://security.ubuntu.com/ubuntu precise-security multiverse
deb-src http://security.ubuntu.com/ubuntu precise-security multiverse
## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu precise partner
# deb-src http://archive.canonical.com/ubuntu precise partner
## This software is not part of Ubuntu, but is offered by third-party
## developers who want to ship their latest software.
deb http://extras.ubuntu.com/ubuntu precise main
# deb-src http://extras.ubuntu.com/ubuntu precise main

评论后,我仍然在源列表/etc/apt/sources.list.d/sbt.list错误中收到 Malformed line 2 。

我该如何解决这个问题?因为我需要解决这个问题并且需要在 IPython 中创建配置文件。

ipython
  • 1 个回答
  • 84 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve