Creating an Enviroment for plotly and matplotlib in python 2.7

谁说胖子不能爱 提交于 2019-12-13 01:05:39

问题


I managed to install on my conda the plotly package with: conda install -c plotly plotly

And the matplotlib with: conda create --name mpl33 python=3.3 matplotlib ipython-notebook

But I cant create one env with both of them inside because the plotly uses python 2.7 and matplotlib python 3.3

Thanks for the help!


回答1:


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.

So first create a conda environment with python 3.6; I name it plotenv here:

> conda create --name plotenv python=3.6

Next install matplotlib to it,

> conda install --name plotenv matplotlib

Finally install plotly to it,

> conda install --name plotenv -c plotly plotly

Done.

Console usage

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

You may then start python

(plotenv) > python 

and import any of the installed submodules, e.g.

>>> from mpl_toolkits.axes_grid1 import ImageGrid

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

Now, starting juypter

(plotenv) > jupyter notebook

would give you the option to create a new notebook with this environment:



来源:https://stackoverflow.com/questions/50476501/creating-an-enviroment-for-plotly-and-matplotlib-in-python-2-7

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