问题
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