第一步:升级python
作为一个进军python的新菜鸟,我遇到了一个问题,在Jupyter Notebook里面我无法使用pyecharts,所以需要安装,我百度了一个常用方法,在win10下,管理员运行cmd,然后输入:pip install pyecharts
运行之后发现安装不了,出现以下错误:You are using pip version 10.0.1, however version 19.0.2 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command.所以需要先输入:
python -m pip install --upgrade pip
安装成功出现如下:
Collecting pip
Downloading https://files.pythonhosted.org/packages/d7/41/34dd96bd33958e52cb4da2f1bf0818e396514fd4f4725a79199564cd0c20/pip-19.0.2-py2.py3-none-any.whl (1.4MB)
100% |████████████████████████████████| 1.4MB 4.8MB/s
Installing collected packages: pip
Found existing installation: pip 10.0.1
Uninstalling pip-10.0.1:
Successfully uninstalled pip-10.0.1
Successfully installed pip-19.0.2
第二步:安装pyecharts
输入:
pip install pyecharts
安装成功出现:
Collecting pyecharts
... ... # 内容太多,省略部分安装信息
Installing collected packages: future, lml, jupyter-echarts-pypkg, pillow, dukpy, macropy3, javascripthon, pyecharts-javascripthon, MarkupSafe, jinja2, pyecharts
Running setup.py install for future ... done
Running setup.py install for jupyter-echarts-pypkg ... done
Running setup.py install for macropy3 ... done
Running setup.py install for javascripthon ... done
Successfully installed MarkupSafe-1.1.0 dukpy-0.2.2 future-0.17.1 javascripthon-0.10 jinja2-2.10 jupyter-echarts-pypkg-0.1.2 lml-0.0.2 macropy3-1.1.0b2 pillow-5.4.1 pyecharts-0.5.11 pyecharts-javascripthon-0.0.6
第三步:测试安装是否成功
打开Jupter Notebook,查验是否成功安装,输入:
from pyecharts import Geo
仍然出现错误:
ImportError Traceback (most recent call last)
in ()
----> 1 import pyecharts
ImportError: No module named 'pyecharts'
没办法,找了一圈,只能去找源路径自己下载了,地址如下:
https://pypi.org/project/pyecharts/#files
这里要感谢一个大神发的文章,里面有链接,不过不是最新的,本文章更新至最新,下面是引用的大神的链接:https://blog.csdn.net/f823154...
下载得到文件pyecharts-0.5.11-py2.py3-none-any.whl
但是我郁闷了,文件放哪啊,怎么打开啊?开始了寻找之旅。
根据一个大神的操作,链接是:https://blog.csdn.net/f823154...
地址放在:
D:\Anaconda3\Lib\site-packages
运行Anaconda Prompt,然后再一次安装升级python
(D:\Anaconda3) C:\Users\xxx>python -m pip install --upgrade pip
再次键入 :pip install pyecharts
安装 pyecharts
OK这下在Jupyter Notebook就可以引用pyecharts啦!!!