IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> 开发工具 -> vscode中使用jupyter调用%matplotlib qt报错问题 -> 正文阅读

[开发工具]vscode中使用jupyter调用%matplotlib qt报错问题

%matplotlib

  1. 调用%matplotlib qt可以在jupyter ipykernel中弹出外置画图显示窗口
  2. 调用%matplotlib inline 可以在jupyter ipykernel中内画图

遇到问题

当我调用%matplotlib qt想在外部画图遇到下面错误

Info 10:14:44: Raw session started and connected
Started kernel Python 3.8.10 64-bit
Info 10:14:44: Finished connecting 2d9b5bfb-79b0-4d36-9289-fe0664f7df80
Info 10:14:44: Executing silently Code (idle) = import sys\nprint(sys.executable)
Info 10:14:45: Executing silently Code (completed) = import sys\nprint(sys.executable)
Info 10:14:45: UpdateWorkingDirectoryAndPath in Kernel
Info 10:14:45: Executing silently Code (idle) = import site\nsite.addsitedir(site.getusersitepackages())\nimport os\nimport sys\n%cd "/home/ubuntu/rl-ui
Info 10:14:45: Executing silently Code (completed) = import site\nsite.addsitedir(site.getusersitepackages())\nimport os\nimport sys\n%cd "/home/ubuntu/rl-ui
Info 10:14:45: Waiting for idle on (kernel): 16c55f0a-4aad-4cb9-b5b3-bfeafa9be4dd -> idle
Info 10:14:45: Finished waiting for idle on (kernel): 16c55f0a-4aad-4cb9-b5b3-bfeafa9be4dd -> idle
Info 10:14:45: Executing silently Code (idle) = __file__ = '/home/ubuntu/rl-uitls/M/TD3/exp2/main.py'
Info 10:14:45: Executing silently Code (completed) = __file__ = '/home/ubuntu/rl-uitls/M/TD3/exp2/main.py'
Info 10:14:45: Adding hash for 1 = 015a0e4fe271 with 2 lines
Info 10:14:45: Cell 1 executed with state Success
Info 10:14:45: Adding hash for 2 = 37e1a253019d with 15 lines
Info 10:14:46: Executing silently Code (busy) = # Query Jupyter server for the info about a dataframe\nimport json as _VSCODE_json\nimport builtins as
Info 10:14:46: Cell 2 executed with state Success
Info 10:14:46: Executing silently Code (completed) = # Query Jupyter server for the info about a dataframe\nimport json as _VSCODE_json\nimport builtins as
Info 10:14:46: Executing silently Code (idle) = import builtins\n_rwho_ls = %who_ls\nbuiltins.print(_VSCODE_getVariableTypes(_rwho_ls))
Info 10:14:46: Executing silently Code (completed) = import builtins\n_rwho_ls = %who_ls\nbuiltins.print(_VSCODE_getVariableTypes(_rwho_ls))
Info 10:14:47: Adding hash for 3 = c234e25135bc with 64 lines
Info 10:14:53: Cell 3 executed with state Success
Info 10:14:55: Adding hash for 4 = fe7ef7b69c60 with 16 lines
Info 10:14:59: Disposing kernel .jvsc74a57bd0916dbcbb3f70747c44a77c7bcd40155683ae19c65e1c03b4aa3499c5328201f1./bin/python3./bin/python3.-m#ipykernel_launcher for notebook vscode-interactive:Interactive-1.interactive due to selection of another kernel or closing of the notebook
Info 10:14:59: Dispose kernel file:///home/ubuntu/rl-uitls/M/TD3/exp2/main.py
Info 10:14:59: Dispose Kernel process
Info 10:14:59: Notebook Closed vscode-interactive:Interactive-1.interactive
Info 10:14:59: Closing interactive window: vscode-interactive:Interactive-1.interactive
Info 10:14:59: Cancel all remaining cells due to dead kernel
Info 10:14:59: Cancel pending cells
Info 10:14:59: Cell 4 executed with state Idle
Info 10:15:35: Creating controller for interactive with interpreter /bin/python3
Info 10:15:35: Starting interactive window with controller ID ms-toolsai.jupyter/.jvsc74a57bd0916dbcbb3f70747c44a77c7bcd40155683ae19c65e1c03b4aa3499c5328201f1./bin/python3./bin/python3.-m#ipykernel_launcher (Interactive)
Info 10:15:35: Setting setActiveController for vscode-interactive:Interactive-1.interactive
Info 10:15:35: Creating controller for interactive with interpreter /bin/python3
Info 10:15:35: TargetController found ID: .jvsc74a57bd0916dbcbb3f70747c44a77c7bcd40155683ae19c65e1c03b4aa3499c5328201f1./bin/python3./bin/python3.-m#ipykernel_launcher (Interactive) for document vscode-interactive:Interactive-1.interactive
Info 10:15:35: Setting controller affinity for vscode-interactive:Interactive-1.interactive .jvsc74a57bd0916dbcbb3f70747c44a77c7bcd40155683ae19c65e1c03b4aa3499c5328201f1./bin/python3./bin/python3.-m#ipykernel_launcher (Interactive)
Info 10:15:36: Starting Notebook in kernel.ts id = .jvsc74a57bd0916dbcbb3f70747c44a77c7bcd40155683ae19c65e1c03b4aa3499c5328201f1./bin/python3./bin/python3.-m#ipykernel_launcher
Info 10:15:36: Creating raw notebook for vscode-interactive:Interactive-1.interactive
Info 10:15:36: Getting preferred kernel for vscode-interactive:Interactive-1.interactive
Info 10:15:36: Computing working directory vscode-interactive:Interactive-1.interactive
Info 10:15:36: Starting raw kernel Python 3.8.10 64-bit for interpreter /bin/python3
Info 10:15:36: installMissingDependencies /bin/python3
Info 10:15:36: IPyKernel found previously in this environment /bin/python3
Info 10:15:36: Kernel launching with ports 9000,9001,9002,9003,9004. Start port is 9000
Info 10:15:36: Process Execution: > /bin/python3 -c "import ipykernel; print(ipykernel.__version__); print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d"); print(ipykernel.__file__)"
> /bin/python3 -c "import ipykernel; print(ipykernel.__version__); print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d"); print(ipykernel.__file__)"
Info 10:15:36: Process Execution: > /bin/python3 -m ipykernel_launcher --ip=127.0.0.1 --stdin=9003 --control=9001 --hb=9000 --Session.signature_scheme="hmac-sha256" --Session.key=b"2ce0cb71-1389-47c6-b1eb-4ee3fd208265" --shell=9002 --transport="tcp" --iopub=9004 --f=/tmp/tmp-1721057Vnptc1MRARS9.json
> /bin/python3 -m ipykernel_launcher --ip=127.0.0.1 --stdin=9003 --control=9001 --hb=9000 --Session.signature_scheme="hmac-sha256" --Session.key=b"2ce0cb71-1389-47c6-b1eb-4ee3fd208265" --shell=9002 --transport="tcp" --iopub=9004 --f=/tmp/tmp-1721057Vnptc1MRARS9.json
Info 10:15:36: Process Execution: cwd: ~/rl-uitls/M/TD3/exp2
cwd: ~/rl-uitls/M/TD3/exp2
Info 10:15:36: ipykernel version 6.0.3 for /bin/python3
Info 10:15:36: ipykernel location ~/.local/lib/python3.8/site-packages/ipykernel/__init__.py for /bin/python3
Warn 10:15:36: StdErr from Kernel Process /home/ubuntu/.local/lib/python3.8/site-packages/traitlets/traitlets.py:2196: FutureWarning: Supporting extra quotes around Unicode is deprecated in traitlets 5.0. Use 'hmac-sha256' instead of '"hmac-sha256"' – or use CUnicode.
  warn(

Warn 10:15:36: StdErr from Kernel Process /home/ubuntu/.local/lib/python3.8/site-packages/traitlets/traitlets.py:2151: FutureWarning: Supporting extra quotes around Bytes is deprecated in traitlets 5.0. Use '2ce0cb71-1389-47c6-b1eb-4ee3fd208265' instead of 'b"2ce0cb71-1389-47c6-b1eb-4ee3fd208265"'.
  warn(

Info 10:15:36: Kernel Output: NOTE: When using the `ipython kernel` entry point, Ctrl-C will not work.

To exit, you will have to explicitly quit this process, by either sending
"quit" from a client, or using Ctrl-\ in UNIX-like environments.

To read more about this, see https://github.com/ipython/ipython/issues/2049


To connect another client to this kernel, use:
    --existing /tmp/tmp-1721057Vnptc1MRARS9.json

Info 10:15:36: Raw session started and connected
Started kernel Python 3.8.10 64-bit
Info 10:15:36: Finished connecting 2d9b5bfb-79b0-4d36-9289-fe0664f7df80
Info 10:15:36: Executing silently Code (idle) = import sys\nprint(sys.executable)
Info 10:15:36: Executing silently Code (completed) = import sys\nprint(sys.executable)
Info 10:15:36: UpdateWorkingDirectoryAndPath in Kernel
Info 10:15:36: Executing silently Code (idle) = import site\nsite.addsitedir(site.getusersitepackages())\nimport os\nimport sys\n%cd "/home/ubuntu/rl-ui
Info 10:15:36: Executing silently Code (completed) = import site\nsite.addsitedir(site.getusersitepackages())\nimport os\nimport sys\n%cd "/home/ubuntu/rl-ui
Info 10:15:36: Waiting for idle on (kernel): 88ecb34f-3e1e-41c9-b407-bc869abbabe2 -> idle
Info 10:15:36: Finished waiting for idle on (kernel): 88ecb34f-3e1e-41c9-b407-bc869abbabe2 -> idle
Info 10:15:36: Executing silently Code (idle) = __file__ = '/home/ubuntu/rl-uitls/M/TD3/exp2/main.py'
Info 10:15:36: Executing silently Code (completed) = __file__ = '/home/ubuntu/rl-uitls/M/TD3/exp2/main.py'
Info 10:15:37: Adding hash for 1 = 9704f7e71b43 with 19 lines
Info 10:15:38: Cell 1 executed with state Success
Error 10:15:38: Disposing session as kernel process died ExitCode: undefined, Reason: /home/ubuntu/.local/lib/python3.8/site-packages/traitlets/traitlets.py:2196: FutureWarning: Supporting extra quotes around Unicode is deprecated in traitlets 5.0. Use 'hmac-sha256' instead of '"hmac-sha256"' – or use CUnicode.
  warn(
/home/ubuntu/.local/lib/python3.8/site-packages/traitlets/traitlets.py:2151: FutureWarning: Supporting extra quotes around Bytes is deprecated in traitlets 5.0. Use '2ce0cb71-1389-47c6-b1eb-4ee3fd208265' instead of 'b"2ce0cb71-1389-47c6-b1eb-4ee3fd208265"'.
  warn(

Info 10:15:38: Dispose Kernel process
Error 10:15:38: Raw kernel process exited code: undefined

解决

我尝试了重装qt5和其他很多方法,然而并没有作用。其实问题来自我把%matplotlib qt这语句放在了代码中间并和其他代码运行在同一个块里面,把%matplotlib qt放在代码首行并单独运行就不会出现这种问题。

  开发工具 最新文章
Postman接口测试之Mock快速入门
ASCII码空格替换查表_最全ASCII码对照表0-2
如何使用 ssh 建立 socks 代理
Typora配合PicGo阿里云图床配置
SoapUI、Jmeter、Postman三种接口测试工具的
github用相对路径显示图片_GitHub 中 readm
Windows编译g2o及其g2o viewer
解决jupyter notebook无法连接/ jupyter连接
Git恢复到之前版本
VScode常用快捷键
上一篇文章      下一篇文章      查看所有文章
加:2022-04-26 11:58:27  更:2022-04-26 11:59:11 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年11日历 -2024/11/14 15:02:45-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码