Jupyter报错ModuleNotFoundError: No module named ‘altair‘

执行的代码:

bash 复制代码
import altair as alt

报错内容:

bash 复制代码
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[1], line 1
----> 1 import altair as alt
      2 import pandas as pd
      4 source = pd.DataFrame(
      5     [
      6         {"a": "a1", "b": "b1", "c": "x", "p": "0.14"},
   (...)
     33     ]
     34 )

ModuleNotFoundError: No module named 'altair'

解决:

安装altair包

bash 复制代码
!pip install altair

等待安装完成:

bash 复制代码
Collecting altair
  Downloading altair-5.3.0-py3-none-any.whl (857 kB)
     ------------------------------------- 857.8/857.8 kB 10.6 kB/s eta 0:00:00
Requirement already satisfied: jsonschema>=3.0 in d:\anaconda\anaconda\lib\site-packages (from altair) (4.17.3)
Requirement already satisfied: pandas>=0.25 in d:\anaconda\anaconda\lib\site-packages (from altair) (1.5.3)
Requirement already satisfied: typing-extensions>=4.0.1 in d:\anaconda\anaconda\lib\site-packages (from altair) (4.4.0)
Requirement already satisfied: toolz in d:\anaconda\anaconda\lib\site-packages (from altair) (0.12.0)
Requirement already satisfied: jinja2 in d:\anaconda\anaconda\lib\site-packages (from altair) (3.1.2)
Requirement already satisfied: numpy in d:\anaconda\anaconda\lib\site-packages (from altair) (1.23.5)
Requirement already satisfied: packaging in d:\anaconda\anaconda\lib\site-packages (from altair) (22.0)
Requirement already satisfied: attrs>=17.4.0 in d:\anaconda\anaconda\lib\site-packages (from jsonschema>=3.0->altair) (22.1.0)
Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in d:\anaconda\anaconda\lib\site-packages (from jsonschema>=3.0->altair) (0.18.0)
Requirement already satisfied: pytz>=2020.1 in d:\anaconda\anaconda\lib\site-packages (from pandas>=0.25->altair) (2022.7)
Requirement already satisfied: python-dateutil>=2.8.1 in d:\anaconda\anaconda\lib\site-packages (from pandas>=0.25->altair) (2.8.2)
Requirement already satisfied: MarkupSafe>=2.0 in d:\anaconda\anaconda\lib\site-packages (from jinja2->altair) (2.1.1)
Requirement already satisfied: six>=1.5 in d:\anaconda\anaconda\lib\site-packages (from python-dateutil>=2.8.1->pandas>=0.25->altair) (1.16.0)
Installing collected packages: altair
Successfully installed altair-5.3.0
相关推荐
爪哇学长2 分钟前
双指针算法详解:原理、应用场景及代码示例
java·数据结构·算法
ExiFengs6 分钟前
实际项目Java1.8流处理, Optional常见用法
java·开发语言·spring
paj1234567897 分钟前
JDK1.8新增特性
java·开发语言
繁依Fanyi19 分钟前
简易安卓句分器实现
java·服务器·开发语言·算法·eclipse
慧都小妮子30 分钟前
Spire.PDF for .NET【页面设置】演示:打开 PDF 时自动显示书签或缩略图
java·pdf·.net
m512734 分钟前
LinuxC语言
java·服务器·前端
IU宝38 分钟前
C/C++内存管理
java·c语言·c++
瓜牛_gn39 分钟前
依赖注入注解
java·后端·spring
hakesashou40 分钟前
Python中常用的函数介绍
java·网络·python
佚先森1 小时前
2024ARM网络验证 支持一键云注入引流弹窗注册机 一键脱壳APP加固搭建程序源码及教程
java·html