简体   繁体   中英

ModuleNotFoundError: No module named 'sklearn' python

For some reason my Python (Spyder) is not recognising sklearn library and pyodbc library

2 weeks ago everything was ok,

but not sure what happened that I am getting this error

ModuleNotFoundError: No module named 'sklearn'

and

ModuleNotFoundError: No module named 'pyodbc'

When I try

pip install sklearn

I get

pip install sklearn
Note: you may need to restart the kernel to use updated packages.
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

I restarted my computer still the same !

Any idea how to fix this?

Edit

When I try to pip install it from Anaconda Poweshell Promopt

(base) PS C:\Users\ASMGX> conda install sklearn
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from current channels:

  - sklearn

Current channels:

  - https://repo.anaconda.com/pkgs/main/win-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/win-64
  - https://repo.anaconda.com/pkgs/r/noarch
  - https://repo.anaconda.com/pkgs/msys2/win-64
  - https://repo.anaconda.com/pkgs/msys2/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.

i know this may not be the best solution.

but it worked for me.

to uninstall Anaconda and Python and re-install them again!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM