The python interpreter I was using is located to '~/miniconda2/bin/python',2.7.11.
The problem is as follows: If the current directory is home directory, I start the python in command line and import skimage.filters library. It works perfectly.
Name:~ Name $ python
>>> import skimage.filters
>>>
But when I tried to cd to another directory and did the same thing. I would get a importError as follows:
Name:~ Name $ cd dir/
Name: dir Name $ python
>>> import skimage.filters
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/Name/miniconda2/lib/python2.7/site-packages/skimage/filters/__init__.py", line 1, in <module>
from .lpi_filter import inverse, wiener, LPIFilter2D
File "/Users/Name/miniconda2/lib/python2.7/site-packages/skimage/filters/lpi_filter.py", line 7, in <module>
from scipy.fftpack import ifftshift
File "/Users/Name/miniconda2/lib/python2.7/site-packages/scipy/fftpack/__init__.py", line 95, in <module>
from .basic import *
File "/Users/Name/miniconda2/lib/python2.7/site-packages/scipy/fftpack/basic.py", line 12, in <module>
from . import _fftpack
ImportError: cannot import name _fftpack
>>>
It's really odd because the paths of the python interpreter and the sys.path
of them are the same. I also tried os.chdir('home directory')
to make sure the os.getcwd()
of both are the same as well. I tried to update the libraries and reinstall them. But the problem is still there.
通过重新安装Python解决。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.