ubuntu environment to build on pyecharts V1 version

1 Background  

  Today, I want to draw with pyecharts, found after use pip install in the new environment, the import pyecharts module has failed, given as follows.

FIG introduction FIG error pyecharts

  Please note: python version I used here is 3.5.2.

  He then went to pyecharts official website went to look and found that the pyecharts updated version V1, use pip are installing the latest version, and use six months ago that the V0.5 version, and version 0.5 is no longer maintained.

FIG schematic version 2 pyecharts

2 environment to build

2.1 install python3.6

  ubuntu 16.4 and 3.5 Python2.7 default installation, but please be careful not to unload the system versions, then we install python3.6, typing the following command in linux terminal.

# The first step 
sudo ppa the Add-APT-Repository: jonathonf / python3.6 # Step 
sudo APT- GET Update
 # Step 
sudo apt-get install python3.6

 

  Now in our Linux systems have Python3.6 up.

FIG 3 Python3.6 schematic installation

Pip3 version 2.2 to solve the problem

  Happily typing the command module after importing pyecharts open python3.6, the results of the question is, given that there is no module.

FIG 4 python3.6 failed introduced pyecharts

  It may be the version of the problem of pip, pip version of the look, and sure enough found the problem.

FIG 5 pip schematic version (V3.5)

  So we want to pip version of change python3.6 version, here is a step change.

#第一步
apt-get remove python3-pip
#第二步
apt-get autoremove
#第三步
apt-get install python3-pip
#第四步
python3.6 -m pip install --upgrade pip

  此时我们再看pip的版本。

图 6  pip版本示意图(V3.6)

2.3 安装pyecharts

  接下来敲入下面命令安装pyecharts了。

pip install pyecharts

 

  安装完成之后我们可以看到,我们安装的pyecharts版本为V1.5.1。

图 7 pyecharts版本示意图(V1.5.1)

2.4 安装snapshot-phantomjs

  如果有直接在本地生成图片的需求的话可以安装snapshot-phantomjs。

pip install snapshot-phantomjs

 

  当然还需要安装nodejs环境才能使用。

#第一步
wget https://nodejs.org/dist/v8.9.3/node-v8.9.3-linux-x64.tar.xz
#第二步
tar -xvf node-v8.9.3-linux-x64.tar.xz
#第三步
tar -xvf node-v8.9.3-linux-x64.tar.xz
#第四步
sudo ln -s /usr/local/node-v8.9.3-linux-x64/bin/node /usr/local/bin/node 
#第五步
sudo ln -s /usr/local/node-v8.9.3-linux-x64/bin/npm /usr/local/bin/npm 

  至此,pyecharts的环境终于搭建完成。

 

 

 

 

 

  

Guess you like

Origin www.cnblogs.com/zhenmei/p/11611928.html