我刚刚在Windows 10上安装了Python 3.5,并尝试从我选择的IDE(Rodeo)运行启动示例。该示例在尝试导入ggplot时出错。具体来说,在这次电话会议
from ggplot import ggplot, aes, geom_bar
给了我:
ImportErrorTraceback (most recent call last)
in ()
----> 1 from ggplot import ggplot, aes, geom_bar
C:\Anaconda3\lib\site-packages\ggplot\__init__.py in ()
17
18
---> 19 from .geoms import geom_area, geom_blank, geom_boxplot, geom_line, geom_point, geom_jitter, geom_histogram, geom_density, geom_hline, geom_vline, geom_bar, geom_abline, geom_tile, geom_rect, geom_bin2d, geom_step, geom_text, geom_path, geom_ribbon, geom_now_its_art, geom_violin, geom_errorbar, geom_polygon
20 from .stats import stat_smooth, stat_density
21
C:\Anaconda3\lib\site-packages\ggplot\geoms\__init__.py in ()
----> 1 from .geom_abline import geom_abline
2 from .geom_area import geom_area
3 from .geom_bar import geom_bar
4 from .geom_bin2d import geom_bin2d
5 from .geom_blank import geom_blank
C:\Anaconda3\lib\site-packages\ggplot\geoms\geom_abline.py in ()
----> 1 from .geom import geom
2
3 class geom_abline(geom):
4 """
5 Line specified by slope and intercept
C:\Anaconda3\lib\site-packages\ggplot\geoms\geom.py in ()
1 from __future__ import (absolute_import, division, print_function,
2 unicode_literals)
----> 3 from ..ggplot import ggplot
4 from ..aes import aes
5
C:\Anaconda3\lib\site-packages\ggplot\ggplot.py in ()
19 from . import discretemappers
20 from .utils import format_ticks
---> 21 import StringIO
22 import urllib
23 import base64
ImportError: No module named 'StringIO'
因此无法导入StringIO。我读过here字母组织不再存在于那种形式,但那里的修复并没有帮助我。有小费吗?可能相关的(尽管我无法判断)是因为我无法通过pip install ggplot --upgrade
更新Scipy或ggplot,但我想/读到某处,因为我的Windows上没有内置编译器机。非常感谢提前!
答案 0 :(得分:0)
嗯,我自己找到了一个解决方案。我pip install ggplot --upgrade
失败了,但是
conda install -c conda-forge ggplot
成功了。