[英]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.在Windows和MacOSX下对我有用的是将Anaconda用于所有Python应用程序。 This post also advises to use Anaconda :
这篇文章还建议使用Anaconda :
Python dependency hell: A compromise between virtualenv and global dependencies? Python 依赖地狱:virtualenv 和全局依赖之间的妥协?
I also found this article to be useful:我还发现这篇文章很有用:
https://github.com/spyder-ide/spyder/wiki/Working-with-packages-and-environments-in-spyder 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/ https://docs.anaconda.com/anaconda/user-guide/getting-started/
Under Windows , open the Anaconda cmd prompt from the Anaconda Navigator .在Windows 下,从Anaconda Navigator打开Anaconda cmd 提示符。 Under MacOSX , just open the cmd prompt.
在MacOSX 下,只需打开 cmd 提示符。
In the cmd prompt, install plotly with this command:在 cmd 提示符下,使用以下命令安装plotly :
conda install plotly
This installs plotly in the Anaconda environment.这在蟒蛇环境plotly安装。
Launch Spyder from the Anaconda Navigator .从Anaconda Navigator启动Spyder 。 Always launch Spyder from the Anaconda Navigator , to make sure you're running the copy of Spyder from the Anaconda environment.
始终从Anaconda Navigator启动Spyder ,以确保您正在从Anaconda环境运行Spyder的副本。
In a Python script, load plotly :在 Python 脚本中,加载plotly :
import plotly as py
After that you should be good to go with plotly .在那之后,你应该很好地使用plotly 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.