没有名为numpy python2.7的模块 [英] no module named numpy python2.7

查看:569
本文介绍了没有名为numpy python2.7的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Linux CentOS 6.5上使用python 2.7。成功使用 yum 安装 numpy 后,我无法导入模块。

I'm using python 2.7 on Linux CentOS 6.5. After successfully using yum to install numpy, I am unable to import the module.

from numpy import *

上面的代码产生以下错误:

The above code produces the following error:

no module named numpy

为什么会这样?

推荐答案

Cent OS将有默认版本Python 2.6.6和你可能已经配置python 2.7可能在/ usr / local / lib。

Cent OS will have default version of Python 2.6.6 and you might have configured python 2.7 may be at /usr/local/lib.

Yum Install将在2.6的site-package目录中安装包检查/usr/lib/python2.6/site-packages,如果存在numpy包文件夹,那么你必须使用tarball为python 2.7安装numpy并运行setup.py。

Yum Install will install package in site-package directory of 2.6 please check /usr/lib/python2.6/site-packages, if numpy package folder is present then you have to either install numpy for python 2.7 using tarball and run setup.py.

另一个hack可能是从2.6版本的site-packages复制numpy目录到2.7版本的site-package。

The other hack could be copy numpy directory from 2.6 version's site-packages to 2.7 version's site-package.

这篇关于没有名为numpy python2.7的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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