import sklearn
I get this error:
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
<ipython-input-9-b7c74cbf5af0> in <module>
----> 1 import sklearn
~\AppData\Roaming\Python\Python37\site-packages\sklearn\__init__.py in <module>
78 # later is linked to the OpenMP runtime to make it possible to introspect
79 # it and importing it first would fail if the OpenMP dll cannot be found.
---> 80 from . import _distributor_init # noqa: F401
81 from . import __check_build # noqa: F401
82 from .base import clone
~\AppData\Roaming\Python\Python37\site-packages\sklearn\_distributor_init.py in <module>
16 # Pre-load the DLL stored in sklearn/.libs by convention.
17 dll_path = op.join(op.dirname(__file__), '.libs', 'vcomp140.dll')
---> 18 WinDLL(op.abspath(dll_path))
19
~\Anaconda3\lib\ctypes\__init__.py in __init__(self, name, mode, handle, use_errno, use_last_error)
354
355 if handle is None:
--> 356 self._handle = _dlopen(self._name, mode)
357 else:
358 self._handle = handle
OSError: [WinError 193] %1 is not a valid Win32 application
please help me with this
Use environments, since you have conda as your package manager. Do the following:
Code:
# create and activate env called ml with Python 3.7 and jupyter lab and scikit-learn
conda create -n ml python=3.7 scikit-learn jupyterlab
conda activate ml
# check that all is fine by print scikit-learn version
python -c "import sklearn;print(sklearn.__version__)"
# if no error, spin jupyter Lab
jupyter lab
You can add more packages to your environment on command line:
conda install -n ml pandas requests
If you want to install pip packages. You must activate the correct environment first.
conda activate ml
python -m pip install geopy
To deactivate conda deactivate
It is good practice to create project specific environments. Install only used packages.
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.