我正在尝试使用命令!pip install psutil安装lib psutil . 当我运行此代码时,我得到了这个
Requirement already satisfied: psutil in /opt/conda/lib/python3.6/site-packages (5.4.8)
之后,我尝试运行此代码:
from plotly.offline import iplot, init_notebook_mode
import plotly.graph_objs as go
import plotly.io as pio
import os
import numpy as np
init_notebook_mode(connected=True)
N = 100
x = np.random.rand(N)
y = np.random.rand(N)
colors = np.random.rand(N)
sz = np.random.rand(N)*30
fig = go.Figure()
fig.add_scatter(x=x,
y=y,
mode='markers',
marker={'size': sz,
'color': colors,
'opacity': 0.6,
'colorscale': 'Viridis'
});
iplot(fig)
pio.write_image(fig, 'fig1.png')
它的工作原理!但是在代码结束时,当我尝试保存图片时,我收到了这个错误:
ValueError: Image generation requires the psutil package.
Install using pip:
$ pip install psutil
Install using conda:
$ conda install psutil
我该怎么做才能安装lib psutil?
我也尝试使用conda install psutil安装并获得:
==> WARNING: A newer version of conda exists. <==
current version: 4.5.8
latest version: 4.5.11
Please update conda by running
$ conda update -n base conda
# All requested packages already installed.
但如果我使用conda update -n base conda,什么都不会发生!