ImportError: cannot import name 'compare_psnr' from 'skimage.measure' (C:\Users\yy\anaconda3\lib\site-packages\skimage\measure\__init__.py)怎么修改这个错误
时间: 2023-06-29 16:14:33 浏览: 209
这个错误是由于Scikit-image版本问题导致的,你可以尝试升级Scikit-image版本,命令如下:
```
pip install --upgrade scikit-image
```
如果升级Scikit-image版本仍然无法解决问题,可以尝试重新安装Scikit-image,命令如下:
```
pip uninstall scikit-image
pip install scikit-image
```
如果仍然无法解决问题,可以考虑查看其他依赖库的版本是否与Scikit-image兼容。
相关问题
ImportError: cannot import name 'compare_psnr' from 'skimage.measure' (D:\anaconda\envs\IMGP\lib\site-packages\skimage\measure\__init__.py)
这个错误是由于在引用的代码中使用了"compare_psnr"这个函数,但是在skimage.measure模块中找不到这个函数导致的。根据引用和引用的信息,解决这个问题的方法是将代码中的"compare_psnr"替换为"peak_signal_noise_ratio",并确保从"skimage.metrics"模块中导入该函数。同样地,将"compare_ssim"替换为"structural_similarity"。这样做可以解决ImportError的问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
ImportError: cannot import name 'compare_ssim' from 'skimage.measure' (D:\Anaconda3\lib\site-packages\skimage\measure\__init__.py)
This error occurs when the 'compare_ssim' function from the 'skimage.measure' module cannot be imported. This may be due to several reasons, including:
1. Incorrect installation of the 'scikit-image' library.
2. The 'compare_ssim' function is not available in the version of scikit-image that you have installed.
3. There may be issues with the path of the module or package.
To resolve this error, you can try the following solutions:
1. Check if you have installed the 'scikit-image' library correctly. You can do this by running 'import skimage' in the Python console. If this command throws an error, then you need to install the library using 'pip install scikit-image'.
2. Check if the 'compare_ssim' function is available in your version of scikit-image. You can check the scikit-image documentation to see if this function is available in your version. If it is not available, you can try upgrading to the latest version of scikit-image.
3. Check if there are any issues with the path of the module or package. You can try uninstalling and reinstalling the 'scikit-image' library to ensure that the path is correct.
If none of the above solutions work, you can try using an alternative library or function for your task.
阅读全文