Requirement already satisfied with psutil

泄露秘密 提交于 2020-05-13 05:29:07

问题


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

What can I do to install the lib 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. 

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


回答1:


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

or

$ python -m pip install psutil

or

$ python3 -m pip install psutil

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 installer

Anaconda installer



来源:https://stackoverflow.com/questions/53700638/requirement-already-satisfied-with-psutil

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!