小编pet*_*ter的帖子

Python Basemap导入错误

有效的是

import mpl_toolkits
Run Code Online (Sandbox Code Playgroud)

什么不起作用(找不到导入错误底图)

from mpl_toolkits.basemap import Basemap
Run Code Online (Sandbox Code Playgroud)

我按照这里的说明操作:

http://matplotlib.org/basemap/users/installing.html

下载了最新的底图*.tar.gz

我运行以下命令:

在geos文件夹中

export GEOS_DIR=~/
./configure --prefix=$GEOS_DIR
make
make install
Run Code Online (Sandbox Code Playgroud)

在底图文件夹中

python setup.py install
Run Code Online (Sandbox Code Playgroud)

一切都以sudo模式运行,没有错误.Goes输出没有python绑定但不是错误所以我不确定.

似乎没有正确安装.

Mac Os X 10.10 Yosemiete Python 2.7.6

如果我输入

pip install basemap --allow-external basemap --allow-unverified basemap

Requirement already satisfied (use --upgrade to upgrade): basemap in /Library/Python/2.7/site-packages
Run Code Online (Sandbox Code Playgroud)

所以它存在但不可导入??????????

解决方案

如果你没有安装macports

port install py-matplotlib-basemap
Run Code Online (Sandbox Code Playgroud)

然后它安装了一大堆扩展.

之后你做:

端口选择列表python

然后它应该是:(如果没有尝试列表中的另一个)

sudo port select --set python python27

macos matplotlib python-2.7 matplotlib-basemap

13
推荐指数
1
解决办法
9405
查看次数

Cplex 库 gcc 编译链接错误

gcc -I/opt/cplex-studio-125/cplex/include -lcplex -L/opt/cplex-studio-125/cplex/lib/x86-64_sles10_4.1/static_pic mipex1.c 
Run Code Online (Sandbox Code Playgroud)

我正在尝试从 cplex 编译一个示例。-I选项很好。该-L选项似乎已损坏,因为它找不到函数名称。

错误在哪里?在特定链接中有一个libcplex.a.

/tmp/ccf5sKky.o: In function `main':
mipex1.c:(.text+0x9f): undefined reference to `CPXopenCPLEX'
mipex1.c:(.text+0xee): undefined reference to `CPXgeterrorstring'
mipex1.c:(.text+0x125): undefined reference to `CPXsetintparam'
mipex1.c:(.text+0x222): undefined reference to `CPXcreateprob'
mipex1.c:(.text+0x2e1): undefined reference to `CPXcopylp'
mipex1.c:(.text+0x334): undefined reference to `CPXcopyctype'
mipex1.c:(.text+0x380): undefined reference to `CPXmipopt'
mipex1.c:(.text+0x3cc): undefined reference to `CPXgetstat'
mipex1.c:(.text+0x403): undefined reference to `CPXgetobjval'
mipex1.c:(.text+0x474): undefined reference to `CPXgetnumrows'
mipex1.c:(.text+0x490): undefined reference to `CPXgetnumcols'
mipex1.c:(.text+0x4be): undefined reference to `CPXgetx'
mipex1.c:(.text+0x51c): …
Run Code Online (Sandbox Code Playgroud)

c gcc compiler-errors undefined-reference cplex

0
推荐指数
1
解决办法
1286
查看次数