使用conda安装的模块,但仍获取ModulenotFoundError
(正在使用Macos Big Sur 11.6.2)
问题首先从Cartopy开始,但是从那以后,我也遇到了Rioxarray和Xarray的问题。我只能想到这是因为我已经使用Conda安装了它们。我以前已经安装了带有PIP的模块,这些模块已导入正常。
如果我执行conda列表
,那么我可以看到所有这些模块,但是在rstudio或jupyter笔记本中导入它们会给我臭名昭著的modulenotfounderror
。
我已经能够在Anaconda Navigator应用程序上看到我的不同环境,并且可以看到这些模块在我的基数(根)环境中。我有基础(root),anaconda3,cartopyenv,test_cartopy_env(来自许多尝试解决问题的尝试),但是当我做conda info -enda info -envs
时,
# conda environments:
#
/Users/me/opt/anaconda3
base * /opt/anaconda3
cartopyenv /opt/anaconda3/envs/cartopyenv
test_cartopy_install /opt/anaconda3/envs/test_cartopy_install
我不确定为什么在Anaconda Navigator中有额外的Anaconda3环境,但是任何人,这就是我所做的。我注意到看我的sys.pat是基本环境不存在的,所以我将/users/me/opt/anaconda3
附加到路径列表(这是我可以看到想要的地方Anaconda Navigator中的模块),但仍然没有成功。无论如何,当我在查找器上打开该文件时,我找不到任何模块,以下是/users/me/opt/opt/anaconda3
目录的列表(我认为这是我认为的是基本目录):
Anaconda-Navigator.app
LICENSE.txt
bin
conda-meta
condabin
doc
etc
include
info
lib
libexec
licensing
man
mkspecs
org.freedesktop.dbus-session.plist
phrasebooks
pkgs
plugins
python.app
qml
resources
sbin
share
shell
ssl
translations
这就是我尝试过的,我不确定该怎么做。我认为Python看上去不是应该的。我不确定如何检查或补救。
(Am using macOS Big Sur 11.6.2)
The problem first started with cartopy, but moving on from that I also encounter the problem with rioxarray and xarray. All I can think is that it is because i've used conda to install them. I have previously installed modules with pip that are importing fine.
If I do conda list
, then I can see all those modules, but importing them in both RStudio or Jupyter notebook gives me the infamous ModuleNotFoundError
.
I have been able to see on the Anaconda Navigator application my different environments, and I can see that the modules are there in my base(root) environment. I have base (root), anaconda3, cartopyenv, test_cartopy_env (from many attempts at trying to solve the problem), but in terminal when I do conda info --envs
:
# conda environments:
#
/Users/me/opt/anaconda3
base * /opt/anaconda3
cartopyenv /opt/anaconda3/envs/cartopyenv
test_cartopy_install /opt/anaconda3/envs/test_cartopy_install
So i'm not sure why theres an extra anaconda3 environment in the Anaconda Navigator, but anywho, that is what i've done. I noticed that looking at my sys.path that the base environment wasn't there, so I appended /Users/me/opt/anaconda3
to the list of paths (which is where i can see the wanted modules in the Anaconda Navigator), but still no success. And in any case, when I open that file on my finder, I can't find any of the modules, here is a list of the /Users/me/opt/anaconda3
directory (which I think is the base directory):
Anaconda-Navigator.app
LICENSE.txt
bin
conda-meta
condabin
doc
etc
include
info
lib
libexec
licensing
man
mkspecs
org.freedesktop.dbus-session.plist
phrasebooks
pkgs
plugins
python.app
qml
resources
sbin
share
shell
ssl
translations
So that's what i've tried and I'm not sure what else to do. I think Python is looking not where it's supposed to be. I'm not sure how to check this or remedy it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论