2

我有兴趣为 python 使用 Mahotas 包,不幸的是我在安装或运行它时遇到了一些问题。当我运行时:

sudo pip install mahotas

我得到:

Requirement already satisfied (use --upgrade to upgrade): mahotas in ./anaconda/lib/python2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): numpy in ./anaconda/lib/python2.7/site-packages (from mahotas)
Cleaning up...

所以我假设它安装正确。当尝试从文档中复制一个简单示例时,我收到以下消息:

ImportError: 
mahotas.imread depends on one of (in order of preference):

1. imread
2. freeimage

None of which could be found!

Everything else will work, though, so this error is only triggered when you
attempt to use these optional functions.

To install imread:

On **Ubuntu**, run the following commands::

    sudo apt-get install libpng12-dev libtiff4-dev libwebp-dev python-pip python-dev g++
    sudo pip install imread

On **Mac OS**, if using ``port``, run the following commands::

    sudo port install libpng tiff webp
    sudo pip install imread

On **Windows**, use Christoph Gohlke's packages. See:

http://www.lfd.uci.edu/~gohlke/pythonlibs/#imread




To install FreeImage:

You need to have the freeimage installed for imread/imsave (everything else
will work, though, so this error is only triggered when you attempt to use
these optional functions). Freeimage is not a Python package, but a regular
package.

Under Linux, look for a package called `freeimage` in your distribution (it is
actually called `libfreeimage3` in debian/ubuntu, for example).

Under Windows, consider using the third-party mahotas packages at
http://www.lfd.uci.edu/~gohlke/pythonlibs/ (kindly maintained by Christoph
Gohlke), which already package freeimage.

Full error was: mahotas.freeimage: could not find libFreeImage in any of thefollowing directories: '/Users/hmcoerver/anaconda/lib/python2.7/site-packages/mahotas/io', '/lib', '/usr/lib', '/usr/local/lib', '/opt/local/lib'

由于我在 Mac 上工作,我按照建议运行:

sudo port install libpng tiff webp
sudo pip install imread

这给了我:

--->  Computing dependencies for libpng
--->  Cleaning libpng
--->  Computing dependencies for tiff
--->  Cleaning tiff
--->  Computing dependencies for webp
--->  Cleaning webp
--->  Scanning binaries for linking errors
--->  No broken files found.

Requirement already satisfied (use --upgrade to upgrade): imread in ./anaconda/lib/python2.7/site-packages
Cleaning up...

所以对我来说,似乎我安装了 imread 就像错误消息告诉我的那样。但是我一直收到同样的信息。

有谁知道如何解决这个问题?非常感谢所有帮助!

4

0 回答 0