libstdc++.so.6: version `GLIBCXX_3.4.21' not found 问题解决

我在安装vn.py时报如下错误:

andy@andy:~/vnpy/examples/VnTrader$ python run.py 
Traceback (most recent call last):
  File "run.py", line 19, in <module>
    from vnpy.trader.gateway import (ctpGateway, oandaGateway, ibGateway, 
  File "/home/andy/anaconda2/lib/python2.7/site-packages/vnpy-1.7.0-py2.7.egg/vnpy/trader/gateway/ctpGateway/__init__.py", line 4, in <module>
    from ctpGateway import CtpGateway
  File "/home/andy/anaconda2/lib/python2.7/site-packages/vnpy-1.7.0-py2.7.egg/vnpy/trader/gateway/ctpGateway/ctpGateway.py", line 16, in <module>
    from vnpy.api.ctp import MdApi, TdApi, defineDict
  File "/home/andy/anaconda2/lib/python2.7/site-packages/vnpy-1.7.0-py2.7.egg/vnpy/api/ctp/__init__.py", line 3, in <module>
    from vnctpmd import MdApi
ImportError: /home/andy/anaconda2/lib/python2.7/site-packages/PyQt5/../../../libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /home/andy/anaconda2/lib/python2.7/site-packages/vnpy-1.7.0-py2.7.egg/vnpy/api/ctp/vnctpmd.so)

我按照以往的方法去更新gcc,libstdc++.so.6等,都是没有作用的,我的系统如下:

andy@andy:/usr/lib$ cat /etc/issue
Ubuntu 16.04.3 LTS \n \l

andy@andy:/usr/lib$ 

我的python环境如下:

andy@andy:/usr/lib$ python --version
Python 2.7.13 :: Anaconda custom (64-bit)

最后在一个github讨论区发现了解决办法,就是安装libgcc

andy@andy:~/vnpy/examples/VnTrader$ conda install libgcc
Fetching package metadata ...........
Solving package specifications: .

Package plan for installation in environment /home/andy/anaconda2:

The following packages will be UPDATED:

    anaconda: 4.3.1-np111py27_0 defaults --> custom-py27_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
    libgcc:   4.8.5-2           defaults --> 5.2.0-0       https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free

Proceed ([y]/n)? y

libgcc-5.2.0-0 100% |################################| Time: 0:00:01 590.91 kB/s
anaconda-custo 100% |################################| Time: 0:00:00   1.71 MB/s
andy@andy:~/vnpy/examples/VnTrader$

之后运行程序就正常了,我在查看anaconda目录下的libstdc++.so.6文件的输出信息发现已经包含GLIBCXX_3.4.21

andy@andy:/usr/lib$ locate libstdc++.so.6
/home/andy/anaconda2/lib/libstdc++.so.6
/home/andy/anaconda2/lib/libstdc++.so.6.0.19
/home/andy/anaconda2/pkgs/libgcc-4.8.5-2/lib/libstdc++.so.6
/home/andy/anaconda2/pkgs/libgcc-4.8.5-2/lib/libstdc++.so.6.0.19
/usr/lib/vmware-tools/lib32/libstdc++.so.6
/usr/lib/vmware-tools/lib32/libstdc++.so.6/libstdc++.so.6
/usr/lib/vmware-tools/lib64/libstdc++.so.6
/usr/lib/vmware-tools/lib64/libstdc++.so.6/libstdc++.so.6
/usr/lib/x86_64-linux-gnu/libstdc++.so.6
/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
/usr/local/anaconda2/lib/libstdc++.so.6
/usr/local/anaconda2/lib/libstdc++.so.6.0.19
/usr/local/anaconda2/pkgs/libgcc-4.8.5-2/lib/libstdc++.so.6
/usr/local/anaconda2/pkgs/libgcc-4.8.5-2/lib/libstdc++.so.6.0.19
/usr/local/robo3t/lib/libstdc++.so.6
/usr/local/robo3t/lib/libstdc++.so.6.0.22
/usr/share/gdb/auto-load/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21-gdb.py
andy@andy:/usr/lib$ strings /home/andy/anaconda2/lib/libstdc++.so.6 | grep GLIBC  
GLIBCXX_DEBUG_MESSAGE_LENGTH
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_3.4.14
GLIBCXX_3.4.15
GLIBCXX_3.4.16
GLIBCXX_3.4.17
GLIBCXX_3.4.18
GLIBCXX_3.4.19
GLIBCXX_3.4.20
GLIBCXX_3.4.21
GLIBC_2.3
GLIBC_2.2.5
GLIBC_2.3.2
andy@andy:/usr/lib$

你可能感兴趣的:(libstdc++.so.6: version `GLIBCXX_3.4.21' not found 问题解决)