解决Pycharm无法导入scipy包的问题(无法安装numpy等其他包同理)
博客专区 > hujukee 的博客 > 博客详情
解决Pycharm无法导入scipy包的问题(无法安装numpy等其他包同理)
hujukee 发表于1年前
解决Pycharm无法导入scipy包的问题(无法安装numpy等其他包同理)
  • 发表于 1年前
  • 阅读 209
  • 收藏 0
  • 点赞 0
  • 评论 0

腾讯云 十分钟定制你的第一个小程序>>>   

摘要: 针对安装python2.7.x或安装pycharm的用户,出现无法导入scipy包的问题,本文给出详细的解决办法,并做了验证。结果证明了方法的可行性。(无法插入图片,请谅解)

1、下载scipy编译包,请根据操作系统位数、python版本对应下载。(本人是win7 32位,python 2.7.11,下载了scipy-0.16.1-win32-superpack-python2.7): https://sourceforge.net/projects/scipy/?source=typ_redirect

2.安装到python.exe所在目录 这里会出现一个错误,如: python version 2.7 required,which was not found in the registry 这是因为程序无法识别注册表中的python2.7,我们新建registry.py文件,输入以下代码并运行。(代码来自:http://effbot.org/zone/python-register.htm)

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() 显示“python 2.7 is already registered”

3、点击scipy-0.16.1-win32-superpack-python2.7.exe安装,已经能自动识别出来python2.7了。

4、验证是否scipy是否安装成功 scipy可以完美使用

标签: scipy pycharm python
共有 人打赏支持
粉丝 0
博文 4
码字总数 986
×
hujukee
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
* 金额(元)
¥1 ¥5 ¥10 ¥20 其他金额
打赏人
留言
* 支付类型
微信扫码支付
打赏金额:
已支付成功
打赏金额: