导入错误:无法导入名称“MNIST”

新手上路,请多包涵

我已经能够 pip 安装所有其他包,例如 bumpy、sklearn 等,但是 mnist 包会抛出如下错误。我一直在尝试使用 sudo pip install 但它也说

applesys$ pip install mnist
Requirement already satisfied: mnist in            /Users/applesys/anaconda3/lib/python3.5/site-packages
Requirement already satisfied: numpy in /Users/applesys/anaconda3/lib/python3.5/site-packages (from mnist)
applesys$ sudo pip install mnist
Password:
The directory '/Users/applesys/Library/Caches/pip/http' or its parent             directory is not owned by the current user and the cache has been disabled.     Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/applesys/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: mnist in    /Users/applesys/anaconda3/lib/python3.5/site-packages
Requirement already satisfied: numpy in /Users/applesys/anaconda3/lib/python3.5/site-packages (from mnist)

导入错误

原文由 jen007 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 790
1 个回答

请注意 python-mnistmnist 是两个不同的包,它们都有一个名为 mnist 的模块。你想要的包是 python-mnist 。所以这样做:

 pip install python-mnist

可能需要卸载 mnist 包:

 pip uninstall mnist

那么您的导入语句应该可以工作。

原文由 dinosaur 发布,翻译遵循 CC BY-SA 3.0 许可协议

推荐问题