问题
I have a virtual environment in which I have installed 'geopandas'. When I do a pip list it lists this package as well. But when I try to call it in my jupyter notebook via 'import geopandas' I get a ModuleNotFoundError. Please help - I'm using windows machine
回答1:
You can verify that your notebook is running in the correct virtual environment by doing:
import sys
sys.version
Here's how to run a Jupyter notebook in a virtualenv.
回答2:
You should check if your notebook is using the correct kernel (the correct virtualenv). If you are still in the kernel using your standard environment and geopandas
is not installed, it is possible you get this error.
So check if you are working in the correct kernel: kernel check
You can install a kernel in jupyter notebook by activating the venv and then installing it:
source activate myenv
python -m ipykernel install --user --name myenv --display-name "Python (myenv)"
More info about this install here.
来源:https://stackoverflow.com/questions/60510648/accessing-package-in-python-virtual-environment