本文介绍了psutil已满足要求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用命令!pip install psutil安装lib psutil.当我运行这段代码时,我得到了

I´m trying to install the lib psutil, using the command !pip install psutil. When I run this code, I got this

Requirement already satisfied: psutil in /opt/conda/lib/python3.6/site-packages (5.4.8)

之后,我尝试运行以下代码:

After that, I try to run this code:

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')

它有效!但是在代码的结尾,当我尝试保存图片时,出现了此错误:

And it works! But at the end of the code, when I try to save the picture, I got this error:

ValueError: Image generation requires the psutil package.

Install using pip:
    $ pip install psutil

Install using conda:
    $ conda install psutil

我该怎么做才能安装lib psutil?

What can I do to install the lib psutil?

我也尝试使用conda install psutil进行安装,并得到了以下提示:

I also try to install using conda install psutil and got this:

==> 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,什么也没发生!

But if I use conda update -n base conda, nothing happend!

推荐答案

最近,我偶然发现了与psutil安装相关的问题,并且我看到了许多安装此python模块的方法.我不确定哪种方法适合您,但是您应该尝试以下选项:

I have stumbled upon this issue related to psutil installation recently, and I saw many different ways of installing this python module. I'm not sure which way will work for you, but you should try these options:

$ pip3 install psutil

$ python -m pip install psutil

$ python3 -m pip install psutil

对于conda数据包管理器更新错误,我之前从未见过此错误,因此也许全新安装应该可以解决此问题.

As for the conda packet manager update error, I've never seen this error before, so maybe doing a fresh installation should solve this issue.

Miniconda安装程序

Anaconda安装程序

这篇关于psutil已满足要求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-18 13:49