简体   繁体   English

没有名为scipy.misc的模块

[英]No module named scipy.misc

I'm trying to set up my python for some works, but I'm struggling so much! 我正在尝试为一些作品设置我的python,但是我却非常努力! I need to use python3.4 and the scipy module. 我需要使用python3.4和scipy模块。

I built the scipy module using the python3 setup.py install command from the terminal, but when I try to import the imread function from the scipy.misc module is says that 我从终端使用python3 setup.py install命令构建了scipy模块,但是当我尝试从scipy.misc模块导入imread函数时 ,则表示

No module named scipy.misc is found.

I read that I need to install PIL or Pillow, but I already did that. 我读到我需要安装PIL或Pillow,但我已经做到了。

What do I have to do now? 我现在该怎么办?

Are you calling ./script.py ? 您在打电话./script.py吗?

In many cases, a script will be hard coded to use the system's python installation, but maybe you installed scipy in a virtualenv or conda env. 在许多情况下,脚本会被硬编码以使用系统的python安装,但也许您将scipy安装在virtualenv或conda env中。

So make sure the first "shebang" line in the script shows the path of the python for which you installed scipy. 因此,请确保脚本中的第一行“ shebang”显示安装了scipy的python的路径。 If it's hard coded, please consider #!/usr/bin/env python instead. 如果是硬编码,请改用#!/usr/bin/env python

Are you calling python script.py ? 您在打电话给python script.py吗?

If so, then make sure which python shows the right path. 如果是这样,请确保which python显示正确的路径。

There is a distribution of Python and other tools called Anaconda which solves many of the install issues like this. 有Python和其他称为Anaconda的工具的发行版,可以解决许多这样的安装问题。
Note: After an install, restart the terminal it should set the path for you if you checked the checkbox to do that. 注意:安装后,重新启动终端,如果您选中了复选框,它将为您设置路径。 Use pip install <package> , or conda install <package> only use python setup.py install if neither of those work, or even better yet you can use the user interface (Anaconda Navigator) to do all this without opening the terminal. 如果不能使用pip install <package>conda install <package>只能使用python setup.py install ,甚至更好,但您可以使用用户界面(Anaconda Navigator)来完成所有这些操作而无需打开终端。

download link 下载链接

Hope this helps. 希望这可以帮助。

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

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