在Mac上安装底图时没有芬克(我尝试了可以​​用Google进行的所有操作) [英] Basemap install on mac without fink (I tried everything I can google)

查看:105
本文介绍了在Mac上安装底图时没有芬克(我尝试了可以​​用Google进行的所有操作)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Python Noob. (使用Mac OS 10.12和Python 3.7) 我正在尝试使用mpl_toolkits.basemap

I am a Python Noob. (Using Mac OS 10.12 & Python 3.7) I'm trying to use mpl_toolkits.basemap

执行代码

from mpl_toolkits.basemap import Basemap

我用Google搜索了matplotlib的方法并成功安装了它. 但是,尽管可以在Mac终端上运行从mpl_toolkits.basemap import底图",

I googled the way to get matplotlib and successfully installed it. However, while it's possible to run "from mpl_toolkits.basemap import Basemap" in terminal on mac,

如果我在IDLE中运行命令,则无法加载.

it fails to be loaded if I run the command within IDLE.

然后,我用Google搜索找出了问题所在,并得到了以下提示: 如果我正确安装了底图,就可以解决.

Then, I googled to figure out the issue and got the hint that it could be resolved if I install Basemap properly.

要安装底图,我认为我需要使用"FINK".

To install Basemap, I think I need to go with "FINK".

但是,Fink仅在我的版本为10.12时才可用于10.5操作系统. 而且FINK网站说在升级FINK之前不要更新操作系统. 但是,对我来说太迟了. 原因我很早以前就更新了操作系统,最近又开始使用Mac学习Python.

However, Fink is only available up to 10.5 OS while mine is 10.12. And FINK website says do not update OS before upgrading FINK. However, it's too late for me. Cause I updated my OS longtime ago and recently I started to learn Python Using Mac.

所以我想,如果有一种方法可以不使用apt-get来安装Basemap, (以下代码来自"无法导入的Python底图模块")

So I guess, if there is a way to install Basemap not using apt-get, (the codes below is from "Python basemap module impossible to import")

sudo apt-get install libgeos-3.5.0
sudo apt-get install libgeos-dev
sudo pip install https://github.com/matplotlib/basemap/archive/master.zip

我认为我的问题可以解决. 由于我真的是菜鸟,因此我不确定这是我无法从mpl_toolkits.basemap import底图"失败的原因.

I think my issue could be cleared. Since I'm really really noob, I'm not sure this is the reason for my failing in "from mpl_toolkits.basemap import Basemap".

到目前为止,我尝试过的是

What I tried so far is

1)brew install basemap 错误

1) brew install basemap with the error of

错误:没有名称为底图"的公式 ==>搜索一个先前删除的公式(在上个月)...警告:自制程序/核心是浅表克隆.要获取完整的历史记录,请执行以下操作: git -C"$(brew --repo homebrew/core)"获取--unshallow

Error: No available formula with the name "basemap" ==> Searching for a previously deleted formula (in the last month)... Warning: homebrew/core is shallow clone. To get complete history run: git -C "$(brew --repo homebrew/core)" fetch --unshallow

2)pip install basemap 错误

2) pip install basemap with the error of

已满足要求

Requirement already satisfied

3)sudo pip install https://github.com/matplotlib/basemap/archive/master.zip

3) sudo pip install https://github.com/matplotlib/basemap/archive/master.zip

,错误为

命令"python setup.py egg_info"失败,错误代码为1 /private/tmp/pip-install-lux494o4/pyproj/

Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-install-lux494o4/pyproj/

4)conda install basemap 并显示以下消息

4) conda install basemap with the following message of

已安装所有请求的软件包.

5)conda install -c conda-forge basemap 并显示以下消息

5) conda install -c conda-forge basemap with the following message

准备交易:完成验证交易:完成执行 交易:完成

Preparing transaction: done Verifying transaction: done Executing transaction: done

任何人都可以帮助正确安装底图以便我可以运行

Can anyone help to install basemap properly so that I could run

"from mpl_toolkits.basemap import Basemap"

在我的IDLe中? 我的IDLE Sheel一直在说

in my IDLe? My IDLE Sheel keeps saying

回溯(最近一次通话最近):文件",第1行,在 从mpl_toolkits.basemap导入Basemap ModuleNotFoundError:没有名为"mpl_toolkits.basemap"的模块

Traceback (most recent call last): File "", line 1, in from mpl_toolkits.basemap import Basemap ModuleNotFoundError: No module named 'mpl_toolkits.basemap'

我的终端在运行代码时没有问题.

while my terminal doesn't have problem with running the code.

请先欣赏一下

推荐答案

有运气吗?我也花了一天的时间与之抗争.当我尝试下载较旧版本的底图时,我获得了最大的成功.

any luck? I spent the day battling this as well. I had the most success when I tried downloading an older version of basemap.

我使用的是python 2.7,它可以正常工作sudo -H pip2 install https://github.com/matplotlib/basemap/archive/v1.1.0.tar.gz

I was using python 2.7 and this worked okay sudo -H pip2 install https://github.com/matplotlib/basemap/archive/v1.1.0.tar.gz

对于python 3,请尝试将pip2替换为pip3pip.

For python 3 try replacing pip2 with pip3 or pip.

这篇关于在Mac上安装底图时没有芬克(我尝试了可以​​用Google进行的所有操作)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆