python scikit错误-没有名为sklearn的模块

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29292340/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 04:20:54  来源:igfitidea点击:

python scikit error - no module named sklearn

pythonscikit-learn

提问by user4352158

When i follow the website (https://www.kaggle.com/wiki/GettingStartedWithPythonForDataScience) and type python makeSubmission.pyI get the following error message :

当我关注网站(https://www.kaggle.com/wiki/GettingStartedWithPythonForDataScience)并输入时,python makeSubmission.py我收到以下错误消息:

ImportError: No module named sklearn

I think I have already successfully installed the following: Python 3.4 for windows sciPy,NumPy and matplotlib setuptools scikit-learn PyCharm

我想我已经成功安装了以下内容:Python 3.4 for windows sciPy、NumPy 和 matplotlib setuptools scikit-learn PyCharm

I then opened "Python 3.4 command line" and typed import sys; print(sys.__path__),but I got the message

然后我打开“Python 3.4命令行”并输入import sys; print(sys.__path__),但我收到了消息

Traceback (most recent call last): File "<stdin>", line 1, in <module>
AttributeError: module object has no attribute '__path__'

Anyone can help?

任何人都可以帮忙吗?

回答by optimist

Looks like you haven't installed scikit-learn properly. pip install -U scikit-learnshould do the job. Also, I would suggest downloading the Anaconda distribution of python if you're planning to use python for kaggle contests. It takes care of all the necessary dependencies and contains all the commonly needed python packages for the contest. I found that easier than the tedious download of the dependencies. Here's the Link

看起来您没有正确安装 scikit-learn。pip install -U scikit-learn应该做的工作。另外,如果您打算在 kaggle 比赛中使用 python,我建议您下载 python 的 Anaconda 发行版。它负责处理所有必要的依赖项,并包含比赛所需的所有常用 Python 包。我发现这比繁琐的依赖项下载更容易。这是链接

回答by PhuTV

The Ubuntu 14.04 package is named python-sklearn (formerly python-scikits-learn) and can be installed using the following command: sudo apt-get install python-sklearn

Ubuntu 14.04 软件包名为 python-sklearn(以前称为 python-scikits-learn),可以使用以下命令安装:sudo apt-get install python-sklearn

回答by Akhzar Nazir

If you are using PyCharm or any other IDE, then you have to install 'sklearn' separately in PyCharm tool too. In My Case I am using PyCharm, select

如果您使用 PyCharm 或任何其他 IDE,那么您也必须在 PyCharm 工具中单独安装“sklearn”。在我的案例中,我使用的是 PyCharm,选择

File Menu-> Default Settings-> Project Interpreter -> Press +button and type 'sklearn'

文件菜单->默认设置->项目解释器->按下+按钮并输入'sklearn'

Press install button. Installation will be done in 10 to 20 seconds.

按安装按钮。安装将在 10 到 20 秒内完成。

2nd option is if you already installed 'sklearn' using terminal then you have to set path in your PyCharm IDE.

第二个选项是,如果您已经使用终端安装了“sklearn”,那么您必须在 PyCharm IDE 中设置路径。