About import Sklearn on Pycharm

Source: Internet
Author: User

My Computer small white one, recently learned Python, in trying to learn the text classification model encountered a problem, on the Pycharm import sklearn problem.

I consolidated anaconda this package on the pycharm2017.3 and installed anaconda2 and Anaconda3, anaconda2 as the default interpreter, and the corresponding version is python2.7. When importing the Sklearn library on Pycharm, the following problems exist (not my picture, but similar), see figure:

I am running at the command prompt there is no problem, began to think that pycharm installation problems, so reinstall once, unresolved, and think it may be the problem of the interpreter, adjusted a bit, also did not solve, find half a day to find the reason.
Here's how to view the Interpreter location: (run this code separately from the command prompt and Pycharm)
Import Sys
Print (sys.executable)

The workaround is as follows:
The first step: Uninstall all the original configuration
Pip Uninstall Scikit-learn
Pip Uninstall NumPy
Pip Uninstall scipy

Step two: Download the WHL file corresponding to the Python version
Download Address: https://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml
As for how to install can refer to my another blog post: http://blog.csdn.net/qq_26591517/article/details/79080787

Step three: Run again, no longer the error, success.

To sum up, you generally see the module does not have a function, not you create a file with the same name is the download of the library has a problem. When you encounter a similar problem, most of the time you want to download the Third-party library again.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.