简体   繁体   English

Mac导入geopandas一直失败-所有尝试解决的报告方法

[英]Importing geopandas keeps failing for Mac - All reported solutions tried

Import geopandas gave me: ImportError: No module named 'geopandas' I researched and applied solutions: 导入geopandas给了我:ImportError:我没有研究和应用解决方案的模块名为“ geopandas”:

!pip uninstall geopandas six pyproj fiona rtree shapely -y !conda install -c conda-forge fiona shapely rtree pyproj geopandas six !conda upgrade --all !pip卸载geopandas六个pyproj fiona rtree -y!conda install -c conda-forge fiona匀称rtree pyproj geopandas六个!conda升级--all

The upgrade operation produced a bodacious list of files being updated and superseded. 升级操作产生了一个庞大的文件列表,这些文件将被更新和取代。 It concluded with the following message 8 times over, each with a different path: 它以以下消息结束了8次,每次消息都有不同的路径:

CondaVerificationError: The package for gxx_impl_linux-64 located at /opt/conda/pkgs/gxx_impl_linux-64-7.2.0-hdf63c60_3 appears to be corrupted. CondaVerificationError:位于/opt/conda/pkgs/gxx_impl_linux-64-7.2.0-hdf63c60_3的gxx_impl_linux-64软件包似乎已损坏。 The path 'bin/x86_64-conda_cos6-linux-gnu-g++' specified in the package manifest cannot be found. 找不到软件包清单中指定的路径“ bin / x86_64-conda_cos6-linux-gnu-g ++”。

When I then did the Import geopandas as gpd, I got the 'no module named geopandas' error message again. 然后,当我以gpd格式导入geopandas时,再次收到“没有名为geopandas的模块”错误消息。

I'm on a MacBook Pro using a Jupyter Notebook and I'm out of ideas. 我在使用Jupyter笔记本电脑的MacBook Pro上,但没有主意。 Anybody have another idea? 有人有其他想法吗? Thanks. 谢谢。

I'd suggest you to create new conda environment with all necessary libraries. 我建议您使用所有必需的库创建新的conda环境。 Before you do that check what channels you have in your conda settings. 在执行此操作之前,请检查您的conda设置中包含哪些频道。

$ conda config --get channels
--add channels 'defaults'   # lowest priority
--add channels 'conda-forge'   # highest priority

If you don't have anaconda and conda-forge you have to add them. 如果没有anaconda和conda-forge,则必须添加它们。

$ conda config --add channel conda-forge

Once it's done, create new environment. 完成后,创建新的环境。 You don't need to pass six , fiona and other libraries because they will be installed along with geopandas . 您不需要通过sixfiona和其他库,因为它们将与geopandas一起安装。 If you are using Jupyter I recommend you to install ipykernel which allow you to add your environment to list of Jupyter kernels. 如果您使用的是Jupyter,我建议您安装ipykernel ,它允许您将环境添加到Jupyter内核列表中。

conda create --name <name-of-your-env> python=3 geopandas=0.4.0 gdal ipykernel

Hit enter and wait for conda. 按Enter键并等待conda。 When installation is finished, activate your environment, test it and if everything is fine register kernel. 安装完成后,激活您的环境,进行测试,如果一切都很好,请注册内核。

conda activate <name-of-your-env>
python -m ipykernel --install --user --name <name-of-your-env> --display-name <name-to-be-displayed>

Enjoy your environment. 享受您的环境。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM