之前我利用anaconda利用pip install seaborn和matplotlib(输入完,安装到默认位置),但是怎么都运行不起来,在网上找了很多方法都没解决,由于之前遇到过类似问题,就想到了更改interpreter。
举简单例子:
首先输入好代码:
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd
df = pd.DataFrame({'x': np.arange(3), 'y': [1, 2, 3]})
sns.lineplot('x', 'y', data=df)
plt.show()
第一次使用的Python Interpreter如下图
运行结果
Traceback (most recent call last):
File “D:/python/Doc/seabornlianxi.py”, line 2, in
import seaborn as sns
ModuleNotFoundError: No module named ‘seaborn’
Process finished with exit code 1
第二次使用的Python Interpreter如下图
运行结果
最后不想更换Interpreter的话,可以点下面的加号,然后下载想要的包。我试了一下,在第一次使用的Interpreter下安装了后,就可以正常使用了。(看来得找找怎么设置pip install得位置了)