简体   繁体   中英

Installing Python Scikit-Learn

I'm running the command "pip3 install scikit-learn", and the command prompt spits out the following error:

reading manifest file 'scikit_learn.egg-info\SOURCES.txt'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\NATHAN~1\AppData\Local\Temp\pip-build-l0z1x7if\scikit-learn\setup.py", line 270, in <module>
    setup_package()
  File "C:\Users\NATHAN~1\AppData\Local\Temp\pip-build-l0z1x7if\scikit-learn\setup.py", line 266, in setup_package
    setup(**metadata)
  File "c:\users\nathanholt\appdata\local\programs\python\python36-32\lib\site-packages\numpy\distutils\core.py", line 171, in setup
    return old_setup(**new_attr)
  File "c:\users\nathanholt\appdata\local\programs\python\python36-32\lib\distutils\core.py", line 148, in setup
    dist.run_commands()
  File "c:\users\nathanholt\appdata\local\programs\python\python36-32\lib\distutils\dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "c:\users\nathanholt\appdata\local\programs\python\python36-32\lib\distutils\dist.py", line 974, in run_command
    cmd_obj.run()
  File "c:\users\nathanholt\appdata\local\programs\python\python36-32\lib\site-packages\numpy\distutils\command\install.py", line 62, in run
    r = self.setuptools_run()
  File "c:\users\nathanholt\appdata\local\programs\python\python36-32\lib\site-packages\numpy\distutils\command\install.py", line 36, in setuptools_run
    return distutils_install.run(self)
  File "c:\users\nathanholt\appdata\local\programs\python\python36-32\lib\distutils\command\install.py", line 557, in run
    self.run_command(cmd_name)
  File "c:\users\nathanholt\appdata\local\programs\python\python36-32\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "c:\users\nathanholt\appdata\local\programs\python\python36-32\lib\distutils\dist.py", line 974, in run_command
    cmd_obj.run()
  File "c:\users\nathanholt\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\command\install_egg_info.py", line 34, in run
    self.run_command('egg_info')
  File "c:\users\nathanholt\appdata\local\programs\python\python36-32\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "c:\users\nathanholt\appdata\local\programs\python\python36-32\lib\distutils\dist.py", line 974, in run_command
    cmd_obj.run()
  File "c:\users\nathanholt\appdata\local\programs\python\python36-32\lib\site-packages\numpy\distutils\command\egg_info.py", line 19, in run
    _egg_info.run(self)
  File "c:\users\nathanholt\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\command\egg_info.py", line 279, in run
    self.find_sources()
  File "c:\users\nathanholt\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\command\egg_info.py", line 306, in find_sources
    mm.run()
  File "c:\users\nathanholt\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\command\egg_info.py", line 533, in run
    self.add_defaults()
  File "c:\users\nathanholt\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\command\egg_info.py", line 569, in add_defaults
    self.read_manifest()
  File "c:\users\nathanholt\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\command\sdist.py", line 201, in read_manifest
    self.filelist.append(line)
  File "c:\users\nathanholt\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\command\egg_info.py", line 475, in append
    path = convert_path(item)
  File "c:\users\nathanholt\appdata\local\programs\python\python36-32\lib\distutils\util.py", line 125, in convert_path
    raise ValueError("path '%s' cannot be absolute" % pathname)
ValueError: path '/home/andy/anaconda3/lib/python3.5/site-packages/numpy/core/include/numpy/arrayobject.h' cannot be absolute
Command "c:\users\nathanholt\appdata\local\programs\python\python36-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\NATHAN~1\\AppData\\Local\\Temp\\pip-build-l0z1x7if\\scikit-learn\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\NATHAN~1\AppData\Local\Temp\pip-7iz3ig6v-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\NATHAN~1\AppData\Local\Temp\pip-build-l0z1x7if\scikit-learn\"

I know my numpy+MKL and Scipy are both up to date, along with my C++ Redistributable. Any idea what could cause this?

Install it from here http://www.lfd.uci.edu/~gohlke/pythonlibs/ . If you use python 3.6 and win64 download scikit_umfpack‑0.2.3‑cp36‑cp36m‑win_amd64.whl this one.

Can you try with Anaconda ? https://www.continuum.io/downloads#windows After installing anaconda you can create a virtual environment with conda: conda create -n myenv python=3.5

After that you will activate the evn source activate myenv (myenv)$ conda install scikit-learn

This works for me

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