Maybe This is a simple question. While I run import seaborn as sns
it returns me an error
No module named 'seaborn'
instead if run:
import sys
sys.path.append("/usr/local/lib/python3.7/site-packages")
import seaborn as sns
I have no error. Why ? because I have python 2.7 and 3 and I'm using Jupyter notebook on python3. I used pip install seaborn
, pip3 install seaborn
and also conda install seaborn
How can I use just import seaborn as sns without add the full path ? The strange thing is that the notebook is running using anaconda, but in it's list of packages seaborn is present.
This usually means that the python version with which you have installed seaborn differs from the one with which you are executing the script.
You can specify the python (and pip) version of the installation using:
python3 -m pip install seaborn
what installs the module using the pip installer of python3, and then executing the script using:
python3 script.py
Edit , thanks to Wayne's comment:
If you're inside a Jupyter notebook, run:
%pip install seaborn
or !pip install seaborn
for Jupyter of version <= 7.2
Let me know if it works for you!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.