Anaconda ImportError: libSM.so.6: cannot open shared object file: No such file or directory

Anaconda ImportError: libSM.so.6: cannot open shared object file: No such file or directory

这是我的 python 导入语句

import plotly as py
import pandas as pd
import numpy as np

import plotly.plotly as py
import plotly.tools as plotly_tools
from plotly.graph_objs import *

os.environ['MPLCONFIGDIR'] = tempfile.mkdtemp()
from matplotlib.finance import quotes_historical_yahoo
import matplotlib.pyplot as plt

from scipy.stats import gaussian_kde

from IPython.display import HTML

它抛出 ImportError ImportError: libSM.so.6: cannot open shared object file: No such file or directory

我知道这个导入语句有问题 import matplotlib.pyplot as plt

如果您正在使用 ubuntu,请尝试此命令: pyqt4 可能缺失

sudo apt-get install -y python-qt4

对我有用。

这取决于您为 matplotlib 使用的 backend

您似乎在使用 Qt 后端。为避免安装 Qt,您可以 change it 到您的发行版的原生内容,例如 GTKAgg

import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt