我正在MacOS Mojave 10.14.2上使用python 3.7构建GIS应用程序。我设置了一个名为miniconda的“ MG”环境,并安装了以下软件包
# packages in environment at /Users/mousetsof/miniconda3/envs/MG:
Name Version Build Channel
anaconda custom py37_0
attrs 18.2.0 py_0 conda-forge
blas 1.0 mkl
boost-cpp 1.68.0 h3a22d5f_0 conda-forge
bzip2 1.0.6 1 conda-forge
ca-certificates 2018.11.29 ha4d7672_0 conda-forge
cairo 1.14.12 h276e583_5 conda-forge
certifi 2018.11.29 py37_1000 conda-forge
click 7.0 py_0 conda-forge
click-plugins 1.0.4 py_0 conda-forge
cligj 0.5.0 py_0 conda-forge
curl 7.63.0 h74213dd_0 conda-forge
cycler 0.10.0 py_1 conda-forge
expat 2.2.6 h0a44026_0 anaconda
fiona 1.8.4 py37hfc77a4a_1 conda-forge
fontconfig 2.13.1 hce039c3_0 conda-forge
freetype 2.9.1 h6debe1e_4 conda-forge
freexl 1.0.5 h470a237_2 conda-forge
gdal 2.3.2 py37hfc77a4a_2 conda-forge
geos 3.7.0 hfc679d8_0 conda-forge
geotiff 1.4.3 h9c44c65_0 conda-forge
gettext 0.19.8.1 h1f1d5ed_1 conda-forge
giflib 5.1.4 h470a237_1 conda-forge
glib 2.56.2 h464dc38_1 conda-forge
hdf4 4.2.13 h951d187_2 conda-forge
hdf5 1.10.4 nompi_h5598ddc_1105 conda-forge
icu 58.2 hfc679d8_0 conda-forge
intel-openmp 2019.1 144
jpeg 9c h470a237_1 conda-forge
json-c 0.13.1 h470a237_1 conda-forge
kealib 1.4.10 heffcb4b_2 conda-forge
kiwisolver 1.0.1 py37h2d50403_2 conda-forge
krb5 1.16.3 hbb41f41_0 conda-forge
libcurl 7.63.0 hbdb9355_0 conda-forge
libcxx 7.0.0 h2d50403_2 conda-forge
libdap4 3.19.1 h18059cb_1 conda-forge
libedit 3.1.20170329 haf1bffa_1 conda-forge
libffi 3.2.1 hfc679d8_5 conda-forge
libgdal 2.3.2 h9c3506f_2 conda-forge
libgfortran 3.0.1 h93005f0_2
libiconv 1.15 h470a237_4 conda-forge
libkml 1.3.0 he469717_9 conda-forge
libnetcdf 4.6.2 h2c3f975_1 conda-forge
libpng 1.6.36 ha92aebf_0 conda-forge
libpq 10.6 hf16a0db_0 conda-forge
libspatialindex 1.8.5 hfc679d8_3 conda-forge
libspatialite 4.3.0a h201a3a7_25 conda-forge
libssh2 1.8.0 h5b517e9_3 conda-forge
libtiff 4.0.10 he6b73bb_1 conda-forge
libxml2 2.9.8 h422b904_5 conda-forge
llvm-meta 7.0.0 0 conda-forge
matplotlib 3.0.2 py37_1 conda-forge
matplotlib-base 3.0.2 py37hb2d221d_1 conda-forge
mkl 2019.1 144
mkl_fft 1.0.6 py37h27c97d8_0
mkl_random 1.0.2 py37h27c97d8_0
munch 2.3.2 py_0 conda-forge
ncurses 6.1 hfc679d8_2 conda-forge
numpy 1.15.4 py37hacdab7b_0
numpy-base 1.15.4 py37h6575580_0
openjpeg 2.3.0 h316dc23_3 conda-forge
openssl 1.0.2p h470a237_2 conda-forge
pandas 0.23.4 py37h6440ff4_0 anaconda
pcre 8.42 h378b8a2_0 anaconda
pip 18.1 py37_1000 conda-forge
pixman 0.34.0 h470a237_3 conda-forge
poppler 0.67.0 hdf8a1b3_2 conda-forge
poppler-data 0.4.9 1 conda-forge
postgresql 10.6 ha408888_0 conda-forge
proj4 5.2.0 h470a237_1 conda-forge
psycopg2 2.7.6.1 py37hdffb7b8_0 conda-forge
pyparsing 2.3.0 py_0 conda-forge
pyproj 1.9.6 py37h429999c_0 conda-forge
pysal 1.14.4.post2 py37_1001 conda-forge
pyshp 2.0.1 py_0 conda-forge
python 3.7.1 h46c1a51_0 conda-forge
python-dateutil 2.7.5 py37_0 anaconda
pytz 2018.7 py37_0 anaconda
readline 7.0 haf1bffa_1 conda-forge
rtree 0.8.3 py37_1000 conda-forge
scipy 1.1.0 py37h1410ff5_2
setuptools 40.6.3 py37_0 conda-forge
shapely 1.6.4 py37hcff0d60_1 conda-forge
six 1.12.0 py37_1000 conda-forge
sqlalchemy 1.2.15 py37h470a237_0 conda-forge
sqlite 3.26.0 hb1c47c0_0 conda-forge
time 1.7 h470a237_1 conda-forge
tk 8.6.9 ha92aebf_0 conda-forge
tornado 5.1.1 py37h470a237_0 conda-forge
tzcode 2018g h470a237_1 conda-forge
wheel 0.32.3 py37_0 conda-forge
xerces-c 3.2.2 h5d6a6da_0 conda-forge
xz 5.2.4 h470a237_1 conda-forge
zlib 1.2.11 h470a237_4 conda-forge
我正在尝试使用matplotlib运行一个简单的脚本
import matplotlib.pyplot as plt
plt.figure(1) # the first figure
plt.subplot(211) # the first subplot in the first figure
plt.plot([1, 2, 3])
plt.subplot(212) # the second subplot in the first figure
plt.plot([4, 5, 6])
plt.figure(2) # a second figure
plt.plot([4, 5, 6]) # creates a subplot(111) by default
plt.figure(1) # figure 1 current; subplot(212) still current
plt.subplot(211) # make subplot(211) in figure1 current
plt.title('Easy as 1, 2, 3') # subplot 211 title
但是即使程序包显示在列表中,我也遇到以下错误
import matplotlib.pyplot as plt
ModuleNotFoundError: No module named 'matplotlib'
实际上,一切正常,直到我做了
conda update all
和 我还安装了QGIS3(仅适用于python 3.6,如果需要也可以安装GDAL),但我将其卸载以防引起问题。 现在,我无法让它在新的MG环境中再次工作。我遇到了更多错误,这是我尝试创建一个全新的新环境的第三次尝试,但是matplotlib仍然有问题。
答案 0 :(得分:0)
对于像我一样在Google上遇到这个问题的任何人,我只是删除并重新创建了conda环境:
conda env remove name_of_your_env
conda env create --name the_yml_defining_your_env
有关如何创建上述yml的信息,请查阅conda文档,因为相关部分位于here。链接的段落以及以下内容取决于您的用例。