在python 2.7中为plotly和matplotlib创建环境 [英] Creating an Enviroment for plotly and matplotlib in python 2.7
问题描述
我设法在conda上安装了plotly软件包,其中包括: 康达安装-c plotly plotly
I managed to install on my conda the plotly package with: conda install -c plotly plotly
和matplotlib具有: conda create --name mpl33 python = 3.3 matplotlib ipython-notebook
And the matplotlib with: conda create --name mpl33 python=3.3 matplotlib ipython-notebook
但是我无法在其中同时创建两个env,因为plotly使用python 2.7和matplotlib python 3.3
But I cant create one env with both of them inside because the plotly uses python 2.7 and matplotlib python 3.3
感谢您的帮助!
推荐答案
安装
如果您创建一个新的环境,我建议您使用一个新的python版本.目前,我将使用python 3.6,因为matplotlib不再支持python 3.3.
Installation
If you create a new environment, I would recommend using a new python version. Currently, I'd use python 3.6, because matplotlib does not support python 3.3 anymore.
因此,首先使用python 3.6创建一个conda环境;我在这里将其命名为plotenv
So first create a conda environment with python 3.6; I name it plotenv
here:
> conda create --name plotenv python=3.6
接下来将matplotlib安装到它,
Next install matplotlib to it,
> conda install --name plotenv matplotlib
最后将它安装在上面,
> conda install --name plotenv -c plotly plotly
完成.
如果要通过source activate plotenv
(在Linux上)或activate plotenv
(在Windows上)使用环境,请不要忘记激活环境.
Don't forget to activate the environment if you want to use it via source activate plotenv
(on linux) or activate plotenv
(on windows).
> activate plotenv
然后您可以启动python
You may then start python
(plotenv) > python
并导入任何已安装的子模块,例如
and import any of the installed submodules, e.g.
>>> from mpl_toolkits.axes_grid1 import ImageGrid
与Jupyter一起使用
如果要在新创建的环境中使用jupyter笔记本,则需要先安装它,
Usage with Jupyter
In case you want to use jupyter notebook with the newly created environment, you need to install it first,
> conda install --name plotenv ipython jupyter
,然后在此环境中运行以下命令:
and then run the following inside this environment:
(plotenv) > python -m ipykernel install --user --name plotenv
现在,开始盗贼
(plotenv) > jupyter notebook
将为您提供在这种环境下创建新笔记本的选项:
would give you the option to create a new notebook with this environment:
这篇关于在python 2.7中为plotly和matplotlib创建环境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!