简体   繁体   English

安装的 conda 包无法导入

[英]installed conda package fails to import

Im using anaconda to install packages and manage my environments on macOS Mojave 10.14.2.我使用anaconda在 macOS Mojave 10.14.2 上安装软件包和管理我的环境。

I installed a new package wget at the terminal我在终端安装了一个新包wget

conda install wget

When I run conda list the package shows up and I get no errors.当我运行conda list ,包出现并且我没有收到任何错误。

However, when I run然而,当我跑

import wget

In spyder or jupyter notebook I get and error:spyderjupyter notebook我得到并出错:

File "<ipython-input-28-1d5f1c9c9a6b>", line 7, in <module> import 
wget ModuleNotFoundError: No module named 'wget'

The package also shows up in my base(root) environment, so I have no idea why spyder or jupyter notebook can't find the package.该包也出现在我的 base(root) 环境中,所以我不知道为什么spyderjupyter notebook找不到该包。

Your command conda install wget installs wget for use at the conda prompt.您的命令conda install wget安装 wget 以在 conda 提示符下使用。 To install wget for import in Python, you need to install a different package:要在 Python 中安装 wget 以进行导入,您需要安装一个不同的包:

conda install -c anaconda pywget

In Python it's still:在 Python 中它仍然是:

import wget

在 conda 提示符下运行此命令并导入,它将起作用

conda install -c anaconda wget 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM