简体   繁体   中英

ModuleNotFoundError: No module named 'pandas' on Jupyter Notebook

I'm running my Jupyter Notebook in a virtual environment.

I've installed pandas in it with pip3 install pandas (I've tried with sudo python3 -m pip install pandas in other venv and without sudo , too, like this other post suggests)

I've tried doing export PYTHONPATH=/home/myuser/Notebooks/venv/lib/python3.8/site-packages

but the error remains (I've restarted the notebook kernel, as well). Any idea?

Maybe your are not installing pandas into the virtual environment correctly.

If you have access to a shell, you can possibly cd into the .venv folder. Then you can run source./bin/activate , after this there should be a (.venv) prefix in your shell window.

Now run your pip3 install pandas commando once again, this time it will install pandas into your virtual environment instead of your global python environment.

Installing packages from Notebook running this cell:

! pip install --user numpy
! pip install --user pandas

changing the kernel reselecting Python3 in Kernel -> Change kernel and restarting it, the problem was fixed!

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM