在python虚拟环境中访问包 [英] Accessing package in python virtual environment

查看:148
本文介绍了在python虚拟环境中访问包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个虚拟环境,其中安装了"geopandas".当我做一个点子列表时,它也会列出该软件包.但是,当我尝试通过'import geopandas'在jupyter笔记本中调用它时,出现ModuleNotFoundError错误.请帮助-我正在使用Windows计算机

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

推荐答案

您应该检查笔记本是否使用了正确的内核(正确的virtualenv).如果您仍在使用标准环境的内核中,并且未安装geopandas,则可能会出现此错误.

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

您可以通过激活venv然后安装它来在jupyter Notebook中安装内核:

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.

这篇关于在python虚拟环境中访问包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆