首页 技术 正文
技术 2022年11月17日
0 收藏 520 点赞 2,164 浏览 1720 个字

解决两个问题:

(1)Import Error: No module named numpy

(2)Python version 2.7 required, which was not found in the registry

(1)这种错误是因为没有安装numpy科学计算库,因此需要安装此模块。

  1. 首先下载正确的exe安装文件:numpy-MKL-1.8.0.win-amd64-py2.7.exe。

  2. 接着我们双加打开安装文件,点击运行按钮python安装numpy科学计算模块

  3. 安装过程很简单,点击下一步python安装numpy科学计算模块

  4. 在第一步,如果你看到自己的python的版本号和安装路径,说明你的numpy下载的版本是正确的,点击下一步python安装numpy科学计算模块

  5. 一直点击下一步即可完成安装python安装numpy科学计算模块python安装numpy科学计算模块

  6. 打开python,我们输入import numpy,如果没有提示错误信息,就说明我们安装完成

注意:在安装的过程中,可能会出现:

Python version 2.7 required, which was not found in the registry

这是因为python安装时没有写入到注册表中:

解决方法为:

写一个如下脚本,可以命名为:PythonRegister.py:

 # script to register Python 2.0 or later for use with win32all
# and other extensions that require Python registry settings
#
# written by Joakim Loew for Secret Labs AB / PythonWare
#
# source:
# http://www.pythonware.com/products/works/articles/regpy20.htm
#
# modified by Valentine Gogichashvili as described in http://www.mail-archive.com/distutils-sig@python.org/msg10512.html import sys from _winreg import * # tweak as necessary
version = sys.version[:3]
installpath = sys.prefix regpath = "SOFTWARE\\Python\\Pythoncore\\%s\\" % (version)
installkey = "InstallPath"
pythonkey = "PythonPath"
pythonpath = "%s;%s\\Lib\\;%s\\DLLs\\" % (
installpath, installpath, installpath
) def RegisterPy():
try:
reg = OpenKey(HKEY_CURRENT_USER, regpath)
except EnvironmentError as e:
try:
reg = CreateKey(HKEY_CURRENT_USER, regpath)
SetValue(reg, installkey, REG_SZ, installpath)
SetValue(reg, pythonkey, REG_SZ, pythonpath)
CloseKey(reg)
except:
print "*** Unable to register!"
return
print "--- Python", version, "is now registered!"
return
if (QueryValue(reg, installkey) == installpath and
QueryValue(reg, pythonkey) == pythonpath):
CloseKey(reg)
print "=== Python", version, "is already registered!"
return
CloseKey(reg)
print "*** Unable to register!"
print "*** You probably have another Python installation!" if __name__ == "__main__":
RegisterPy()

然后在CMD中执行:

启动命令切换到PythonRegister.py文件目录下执行

python安装numpy科学计算模块

重新安装PIL,错误解决,安装成功。

此时就可以重新安装numpy库。

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,103
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,579
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,427
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,199
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,834
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,917