Jupyter 笔记本快照包未看到/导入包/模块

Jupyter 笔记本快照包未看到/导入包/模块

Jupyter 笔记本 snap 包未看到/导入包/模块

我正在尝试将列表转换为向量 numpy float32 列表数组

我正在运行 Ubuntu 18.04,并从软件中心安装了 Jupyter

使用的代码:

import sys
!{sys.executable} -m pip install numpy
import numpy as np
x = [1, 2, 3, 4]
y = [10, 20, 30, 40]
z = [100, 200, 300, 400]

xyz = (list(zip(x, y, z)))
xyz = np.float32(xyz)
type(xyz)

输出:

Python

答案1

我的系统检查过了,必须重启才能开始工作

import sys
!{sys.executable} -m pip install numpy
import numpy as np
x = [1, 2, 3, 4]
y = [10, 20, 30, 40]
z = [100, 200, 300, 400]

xyz = (list(zip(x, y, z)))
xyz = np.float32(xyz)
print(type(xyz))
print(xyz)

输出:

    Requirement already satisfied: numpy in /home/rt/snap/jupyter/common/lib/python3.7/site-packages (1.19.0)
<class 'numpy.ndarray'>
[[  1.  10. 100.]
 [  2.  20. 200.]
 [  3.  30. 300.]
 [  4.  40. 400.]]

相关内容