當我導入一個python終端沒有問題:導入工程,但不是IPython的
$ python
Python 3.5.4 | packaged by conda-forge | (default, Aug 10 2017, 01:41:15)
[GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import georasters
>>> from osgeo import gdal
ModuleNotFoundError
當我做同樣的事情在一個IPython的終端:
$ ipython
Python 3.6.1 |Anaconda 4.4.0 (x86_64)| (default, May 11 2017, 13:04:09)
Type "copyright", "credits" or "license" for more information.
IPython 5.3.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: import georasters
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-5a74495660ba> in <module>()
----> 1 import georasters
ModuleNotFoundError: No module named 'georasters'
In [2]: from osgeo import gdal
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-2-a04b80bf4e65> in <module>()
----> 1 from osgeo import gdal
ModuleNotFoundError: No module named 'osgeo'
爲什麼和怎麼可能我解決這個問題?我有一個MAC El Capitan和python 3.6.1。我已經安裝了所有與conda install ...
謝謝。
conda list
$ conda list
# packages in environment at /Users/<myname>/anaconda/envs/cv:
#
affine 2.1.0 py35_0 conda-forge
attrs 17.2.0 py35_0 conda-forge
boost 1.64.0 py35_3 conda-forge
boost-cpp 1.64.0 1 conda-forge
boto3 1.4.4 py35_0 conda-forge
botocore 1.5.92 py35_0 conda-forge
bzip2 1.0.6 1 conda-forge
ca-certificates 2017.7.27.1 0 conda-forge
cairo 1.14.6 4 conda-forge
cartopy 0.15.1 np112py35_2 conda-forge
certifi 2017.7.27.1 py35_0 conda-forge
chardet 3.0.2 py35_1 conda-forge
click 6.7 py35_0 conda-forge
click-plugins 1.0.3 py35_0 conda-forge
cligj 0.4.0 py35_0 conda-forge
cloudpickle 0.3.1 py35_0 conda-forge
curl 7.54.1 0 conda-forge
cycler 0.10.0 py35_0 conda-forge
dask 0.13.0 py35_0 ozak
decorator 4.1.2 py35_0 conda-forge
descartes 1.1.0 py35_0 conda-forge
docopt 0.6.2 py35_0 conda-forge
docutils 0.13.1 py35_0 conda-forge
expat 2.1.0 3 conda-forge
fiona 1.7.8 py35_1 conda-forge
fontconfig 2.12.1 4 conda-forge
freetype 2.7 1 conda-forge
freexl 1.0.2 2 conda-forge
gdal 2.2.0 np112py35_2 conda-forge
geopandas 0.2.1 py35_4 conda-forge
geopy 1.11.0 py35_0 conda-forge
georasters 0.5.6 py35_0 ozak
geos 3.5.1 1 conda-forge
gettext 0.19.8.1 0 conda-forge
giflib 5.1.4 0 conda-forge
glib 2.51.4 0 conda-forge
hdf4 4.2.12 0 conda-forge
hdf5 1.8.18 1 conda-forge
hypothesis 3.17.0 py35_0 conda-forge
icu 58.1 1 conda-forge
idna 2.5 py35_0 conda-forge
imageio 2.2.0 py35_0 conda-forge
jmespath 0.9.3 py35_0 conda-forge
jpeg 9b 0 conda-forge
json-c 0.12.1 0 conda-forge
kealib 1.4.7 2 conda-forge
krb5 1.14.2 0 conda-forge
libdap4 3.18.3 2 conda-forge
libffi 3.2.1 3 conda-forge
libgdal 2.1.4 2 conda-forge
libgfortran 3.0.0 0 conda-forge
libiconv 1.14 4 conda-forge
libkml 1.3.0 1 conda-forge
libnetcdf 4.4.1.1 6 conda-forge
libpng 1.6.28 1 conda-forge
libpq 9.6.3 0 conda-forge
libspatialindex 1.8.5 1 conda-forge
libspatialite 4.3.0a 15 conda-forge
libssh2 1.8.0 1 conda-forge
libtiff 4.0.6 7 conda-forge
libxml2 2.9.4 4 conda-forge
libxslt 1.1.29 5 conda-forge
lxml 3.8.0 py35_0 conda-forge
matplotlib 2.0.2 py35_2 conda-forge
mkl 2017.0.3 0
munch 2.2.0 py35_0 conda-forge
ncurses 5.9 10 conda-forge
networkx 1.11 py35_0 conda-forge
numpy 1.12.1 py35_0
olefile 0.44 py35_0 conda-forge
openjpeg 2.1.2 2 conda-forge
openssl 1.0.2l 0 conda-forge
owslib 0.14.0 py35_0 conda-forge
pandas 0.20.3 py35_1 conda-forge
pcre 8.39 0 conda-forge
pillow 4.2.1 py35_1 conda-forge
pip 9.0.1 py35_0 conda-forge
pixman 0.34.0 0 conda-forge
poppler 0.52.0 2 conda-forge
poppler-data 0.4.7 0 conda-forge
proj4 4.9.3 4 conda-forge
psycopg2 2.7.3 py35_0 conda-forge
pyepsg 0.3.2 py35_0 conda-forge
pympler 0.5 py35_0 conda-forge
pyparsing 2.2.0 py35_0 conda-forge
pyproj 1.9.5.1 py35_0 conda-forge
pysal 1.13.0 py35_0 conda-forge
pyshp 1.2.11 py35_0 conda-forge
python 3.5.4 0 conda-forge
python-dateutil 2.6.1 py35_0 conda-forge
pytz 2017.2 py35_0 conda-forge
pywavelets 0.5.2 np112py35_0 conda-forge
rasterio 0.36.0 py35_0 conda-forge
rasterstats 0.11.0 py35_0 ozak
readline 6.2 0 conda-forge
requests 2.18.3 py35_0 conda-forge
rtree 0.8.3 py35_0 conda-forge
s3transfer 0.1.10 py35_1 conda-forge
scikit-image 0.13.0 py35_1 conda-forge
scipy 0.19.1 np112py35_0
setuptools 36.2.2 py35_0 conda-forge
shapely 1.5.17 py35_4 conda-forge
simplejson 3.11.1 py35_0 conda-forge
six 1.10.0 py35_1 conda-forge
snuggs 1.4.1 py35_0 conda-forge
sqlalchemy 1.1.11 py35_0 conda-forge
sqlite 3.13.0 1 conda-forge
tk 8.5.19 2 conda-forge
toolz 0.8.2 py35_0 conda-forge
tornado 4.5.1 py35_0 conda-forge
urllib3 1.21.1 py35_0 conda-forge
wheel 0.29.0 py35_0 conda-forge
xerces-c 3.1.4 3 conda-forge
xz 5.2.2 0 conda-forge
zlib 1.2.8 3 conda-forge
zope 1.0 py35_0
zope.interface 4.4.2 py35_0
似乎你有兩個不同的python安裝,你正在尋找的模塊只適用於一個。 – pvg
太好了,謝謝!我現在應該怎麼做? – user2725109
看看你的$ PATH,運行'which python'和'which ipython'等。也許你有不同的conda安裝程序? – pvg