[英]ModuleNotFoundError: No module named 'pandas' on Jupyter Notebook
I'm running my Jupyter Notebook in a virtual environment.我在虚拟环境中运行我的 Jupyter Notebook。
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 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
我试过
export PYTHONPATH=/home/myuser/Notebooks/venv/lib/python3.8/site-packages
but the error remains (I've restarted the notebook kernel, as well).但错误仍然存在(我也重新启动了笔记本 kernel)。 Any idea?
任何想法?
Maybe your are not installing pandas into the virtual environment correctly.也许您没有将 pandas 正确安装到虚拟环境中。
If you have access to a shell, you can possibly cd
into the .venv
folder.如果您有权访问 shell,则可以
cd
进入.venv
文件夹。 Then you can run source./bin/activate
, after this there should be a (.venv)
prefix in your shell window.然后你可以运行
source./bin/activate
,之后你的 shell window 中应该有一个(.venv)
前缀。
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.现在再次运行您的
pip3 install pandas
commando,这一次它将 pandas 安装到您的虚拟环境中,而不是您的全局 python 环境中。
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!更改 kernel 在 Kernel 中重新选择
Kernel -> Change kernel
并重新启动它,问题已解决!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.