问题
When trying to install Python's sklearn package on Windows 10 using pip I am given an EnvironmentError that tells me there is no such file or directory of a specific file:
ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: 'C:\Users\Rik\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\sklearn\datasets\tests\data\openml\292\api-v1-json-data-list-data_name-australian-limit-2-data_version-1-status-deactivated.json.gz'
I have tried reinstalling the following packages numerous times:
- scikit-learn
- scipy
- sklearn
I have also tried downloading the github master folder for sklearn and pasting it into the directory where the installer expects the file to be, and even then when installing with pip it tells me the file is missing.
Furthermore I tried installing it via the github repository by downloading it and running
python setup.py install
But this results in weird Microsoft Visual Studio errors because apparently it is trying to run a test program or something, not sure.
Any suggestions to fix this problem?
回答1:
You can find the solution here: https://scikit-learn.org/stable/install.html
The problem occurs because the default path size limit is reached in your case, you can change this with the following steps:
- open regedit tool (using windows cmd)
- access the 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem' key
- change the 'LongPathsEnabled' value to 1
- reinstall sklearn using the command 'pip install --exists-action=i scikit-learn'
来源:https://stackoverflow.com/questions/60756394/python-sklearn-installation-windows