简体   繁体   中英

in Spyder ModuleNotFoundError: No module named 'plotly'

New to python. Not sure how to to add a module.

import plotly.express as px

Error:

ipdb> ModuleNotFoundError: No module named 'plotly'

What steps are need to have this module recognised?

What worked for me, both under Windows and under MacOSX , is using Anaconda for all Python apps. This post also advises to use Anaconda :
Python dependency hell: A compromise between virtualenv and global dependencies?

I also found this article to be useful:
https://github.com/spyder-ide/spyder/wiki/Working-with-packages-and-environments-in-spyder

These are the steps I took.

  • Install Anaconda :
    https://docs.anaconda.com/anaconda/user-guide/getting-started/

  • Under Windows , open the Anaconda cmd prompt from the Anaconda Navigator . Under MacOSX , just open the cmd prompt.

  • In the cmd prompt, install plotly with this command:

     conda install plotly

    This installs plotly in the Anaconda environment.

  • Launch Spyder from the Anaconda Navigator . Always launch Spyder from the Anaconda Navigator , to make sure you're running the copy of Spyder from the Anaconda environment.

  • In a Python script, load plotly :

     import plotly as py

After that you should be good to go with plotly .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM