2016-07-29 203 views
0

我是Python新手。所以,提前抱歉,如果这听起来很愚蠢,但我无法在论坛中找到可以理解的解决方案。我试图在Pycharm中运行我的程序,并最近将其从Python 3.5更改为Python 2.7.12。这样做之后,我已经开始提示以下错误:在从进口Scikit学习:导入期间Scikit-learn中的运行时错误

File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sklearn/__check_build/__init__.py", line 46, in <module> 
    raise_build_error(e) 
    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sklearn/__check_build/__init__.py", line 41, in raise_build_error 
    %s""" % (e, local_dir, ''.join(dir_content).strip(), msg)) 
ImportError: dynamic module does not define init function (init_check_build) 
___________________________________________________________________________ 
Contents of /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sklearn/__check_build: 
__init__.py    __init__.pyc    _check_build.so 
setup.py     setup.pyc 
___________________________________________________________________________ 
It seems that scikit-learn has not been built correctly. 

If you have installed scikit-learn from source, please do not forget 
to build the package before using it: run `python setup.py install` or 
`make` in the source directory. 

If you have used an installer, please check that it is suited for your 
Python version, your operating system and your platform. 

Process finished with exit code 1 

我使用Pycharm IDE - 2016.1,Mac OS中,Python的2.7.12。请让我知道如何解决这个问题。

感谢

回答

1

它看起来像你还在运行的lib/python2.7/site-packages/,按您的错误消息。你需要配置你的解释器来使用Python 3的Anaconda。如果你已经正确安装了Anaconda,你应该可以进入Settings - > NameOfYourProject - > Project Interpreter。将解释器更改为指向您的Anaconda 3.x堆栈。

此外,请确保您下载/安装Anaconda 3.x(不只是Python)。 Anaconda 3带有Python 3解释器,所以你只需要安装最新版本,你应该可以在Pycharm下拉菜单中找到它。

+0

是的我已经尝试了所有,但Python 3 scipy,因为我使用一个实施的项目作为一个库在Python 2.7中实现,它会导致问题,并引发运行时错误。所以我已经用Python 2.7切换到Canopy IDE。 –

+0

感谢您的帮助。 –