Python 在 Anaconda 中安装 Plotly
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34072117/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Install Plotly in Anaconda
提问by xpt
How to install Plotly in Anaconda?
如何在 Anaconda 中安装 Plotly?
The https://conda.anaconda.org/plotlysays to conda install -c https://conda.anaconda.org/plotly <package>
, and
该https://conda.anaconda.org/plotly说来conda install -c https://conda.anaconda.org/plotly <package>
,和
The https://plot.ly/python/user-guide/says to pip install plotly
. I.e., without package.
该https://plot.ly/python/user-guide/说来pip install plotly
。即,没有包。
So which packages I should specify in Anaconda conda?
那么我应该在 Anaconda conda 中指定哪些包?
I tried without one and get errors:
我试过没有一个并得到错误:
C:\>conda install -c https://conda.anaconda.org/plotly
Error: too few arguments, must supply command line package specs or --file
采纳答案by economy
If you don't care which version of Plotly you install, just use pip
.
如果您不在乎安装哪个版本的 Plotly,只需使用pip
.
pip install plotly
is an easy way to install the latest stable package for Plotly from PyPi.
pip install plotly
是一种从 PyPi 为 Plotly 安装最新稳定包的简单方法。
pip
is a useful package and dependency management tool, which makes these things easy, but it should be noted that Anaconda's conda
tool will do the same thing.
pip
是一个有用的包和依赖项管理工具,它使这些事情变得容易,但需要注意的是 Anaconda 的conda
工具也会做同样的事情。
pip
will install to your Anaconda install location by default.
pip
默认情况下将安装到您的 Anaconda 安装位置。
Check out thisdescription of package and environment management between pip
and conda
.
看看这个包,并与环境管理的说明pip
和conda
。
Edit: The link will show that conda
can handle everything pip
can and more, but if you're not trying to specify the version of the package you need to install, pip
can be much more concise.
编辑:该链接将显示conda
可以处理一切pip
可以等等,但如果您不想指定需要安装的软件包版本,pip
则可以更简洁。
回答by Manoj Kumar
Suppose you have Anaconda installed than 'pip' might not work, in that case use:
假设您安装了 Anaconda,但 'pip' 可能不起作用,在这种情况下使用:
conda install -c https://conda.anaconda.org/plotlyplotly
conda install -c https://conda.anaconda.org/plotly
回答by gchaks
Using Anaconda, the following worked for me:
使用 Anaconda,以下内容对我有用:
To search for which plotly packages are available on anaconda:
anaconda search -t conda plotly
This will provide a list of user/package for plotly available.
要在 anaconda 上搜索哪些 plotly 包可用:
anaconda search -t conda plotly
这将提供可用于 plotly 的用户/包列表。
Decide which user/package works for your operating system and which version of Plotly you want. Then to get more information about that type in: anaconda show [user]/[package]
. Installation instruction should be provided near the end. Typically, this is: conda install --channel https://conda.anaconda.org/[user] [package]
where you should replace [user] and [package] with the user/package of your preference.
决定哪个用户/包适用于您的操作系统以及您想要哪个版本的 Plotly。然后获取有关该类型的更多信息:anaconda show [user]/[package]
。安装说明应在最后提供。通常,这是:conda install --channel https://conda.anaconda.org/[user] [package]
您应该将 [user] 和 [package] 替换为您喜欢的用户/包的位置。
回答by OmerB
Clearing things up
收拾东西
@xpt, you have some confusion here:
@xpt,你在这里有些困惑:
- Conda is used to install packages(
plotly
is a package,numpy
is a package,cufflinks
is a package etc.) - The list of available packages is found in some index, which in Conda parlance is called a channel. The default, "official" channel is maintained by Anaconda (Conda's developer), but anyone can open his own channel, and use it to distribute custom packages.
- Conda 用于安装包(
plotly
是包、numpy
是包、cufflinks
是包等) - 可用包的列表可在某个索引中找到,在 Conda 的说法中称为channel。默认的“官方”频道由 Anaconda(Conda 的开发人员)维护,但任何人都可以打开自己的频道,并使用它来分发自定义包。
So, in the command you've shown:
conda install -c https://conda.anaconda.org/plotly <package>
因此,在您显示的命令中:
conda install -c https://conda.anaconda.org/plotly <package>
- The
-c
switch tells Conda to use a custom channel which happens to be calledhttps://conda.anaconda.org/plotly
1 <package>
is the package to download from that channel.- Specifying a channel is optional, and if you don't - then Conda will look in its default channels. But you must specify a package so that Conda knows what to install.
- 该
-c
开关告诉 Conda 使用一个自定义通道,该通道恰好称为https://conda.anaconda.org/plotly
1 <package>
是要从该频道下载的包。- 指定频道是可选的,如果您不指定 - 那么 Conda 将查看其默认频道。但是您必须指定一个包,以便 Conda 知道要安装什么。
1 This is in fact a channel that belongs to a usercalled plotly, which is hosted on Anaconda Cloud, a free service offered by Anaconda to host custom channels.
1 这实际上是一个属于名为 plotly的用户的频道,该频道托管在Anaconda Cloud 上,Anaconda 提供的一项免费服务用于托管自定义频道。
Back to your question
回到你的问题
This channel seems to be unmaintained (the plotly
package hosted there is very old). Given that, and the fact that the official plotly documentationsays to use pip
, that is what I would use.
这个频道似乎没有维护(plotly
那里托管的包很旧)。考虑到这一点,以及官方 plotly 文档说要使用的事实pip
,这就是我会使用的。
Update:plotly updated their conda build, and added conda as an installation option in their GitHub repo(albeit not in their documentationwebsite). So you can now safely use:
更新:情节更新了他们的 conda 构建,并在他们的GitHub 存储库中添加了 conda 作为安装选项(尽管不在他们的文档网站中)。所以你现在可以安全地使用:
conda install -c https://conda.anaconda.org/plotly plotly
or even simpler (since Anaconda Cloud channels are searched automatically):
甚至更简单(因为会自动搜索 Anaconda Cloud 频道):
conda install -c plotly plotly
When using Anaconda Python, conda is the preferred way to install packages, but in any case both conda and pip should be run under Anaconda Prompton Windows (Start --> Anaconda --> Anaconda Prompt
).
Installing packages from the standard command prompt when you have Anaconda is discouraged and can mess up your Anaconda installation.
使用 Anaconda Python 时,conda 是安装软件包的首选方式,但在任何情况下,conda 和 pip 都应在 Windows ( )上的Anaconda Prompt下运行Start --> Anaconda --> Anaconda Prompt
。当您有 Anaconda 时,不鼓励从标准命令提示符安装软件包,这可能会弄乱您的 Anaconda 安装。
回答by Yash Trivedi
To install plotly in windows on anaconda. Go to anaconda prompt, write in this code :
在 anaconda 的 windows 中安装 plotly。转到 anaconda 提示符,输入以下代码:
conda install -c plotly plotly
It will automatically update the modules and the rest should take care of itself. I also did not find the need to close and refresh spyder and the graphs started working on mine
它会自动更新模块,其余的应该自行处理。我也没有发现需要关闭和刷新 spyder 并且图表开始在我的上工作