Accessing package in python virtual environment

情到浓时终转凉″ 提交于 2020-03-25 18:42:59

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!