我刚刚在 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。我在这里读到 StringIO 不再以这种形式存在,但那里的修复并没有帮助我。有小费吗?可能相关(尽管我无法判断)是我无法通过 更新 Scipy 或 ggplot pip install ggplot --upgrade
,但我认为/在某处读到了这种情况,因为我的 Windows 机器上没有内置编译器。提前谢谢了!