简体   繁体   English

尝试在 Python 3.8 上安装 Sklearn 时出现错误

[英]Trying to Install Sklearn on Python 3.8 Gives an Error

I'm trying to install sklearn (scikit-learn) on Python 3.8 on Windows 10 using the following:我正在尝试使用以下命令在 Windows 10 上的 Python 3.8 上安装 sklearn(scikit-learn):

pip install sklearn

I've also used:我也用过:

pip3 install sklearn

pip install scikit-learn 

pip install -U scikit-learn 

As well as:也:

pip install --only-binary :all: sklearn

I've also tried upgrading pip/setuptools.我也尝试过升级 pip/setuptools。

There is a long block of errors;有很长的错误块; among them, the portion which seems to be relevant mentions Fortran:其中,似乎相关的部分提到了 Fortran:

 customize GnuFCompiler Could not locate executable g77 Could not locate executable f77 customize IntelVisualFCompiler Could not locate executable ifort Could not locate executable ifl customize AbsoftFCompiler Could not locate executable f90 customize CompaqVisualFCompiler Could not locate executable DF customize IntelItaniumVisualFCompiler Could not locate executable efl customize Gnu95FCompiler Could not locate executable gfortran Could not locate executable f95 customize G95FCompiler Could not locate executable g95 customize IntelEM64VisualFCompiler customize IntelEM64TFCompiler Could not locate executable efort Could not locate executable efc customize PGroupFlangCompiler Could not locate executable flang don't know how to compile Fortran code on platform 'nt' NOT AVAILABLE

Another part of the error:错误的另一部分:

No module named 'numpy.distutils._msvccompiler' in numpy.distutils; numpy.distutils 中没有名为“numpy.distutils._msvccompiler”的模块;

I'm just wondering if this is because of the newness of 3.8?我只是想知道这是否是因为 3.8 的新颖性? Is there a workaround anyone is aware of?有没有人知道的解决方法?

It seems to revolve around NumPy.它似乎围绕 NumPy 展开。 I've uninstalled that package and reinstalled it.我已经卸载了 package 并重新安装了它。

Just found this GitHub issue saying the following (16 days ago):刚刚发现这个GitHub 问题如下(16 天前):

Python 3.8 is not officially supported by NumPy yet. NumPy 尚未正式支持 Python 3.8。 We strongly suggest you stick with python 3.7 for now, until you see a 3.8 designation in the "Programming Language" section of the PyPI numpy page (probably several weeks) or until an Anaconda release with Python 3.8 is available (probably several months) We strongly suggest you stick with python 3.7 for now, until you see a 3.8 designation in the "Programming Language" section of the PyPI numpy page (probably several weeks) or until an Anaconda release with Python 3.8 is available (probably several months)

So it looks like it might be the underlying dependencies just not working with 3.8 yet.所以看起来它可能是底层依赖项,只是还不能与 3.8 一起使用。 I actually had a similar issue with another package last week.上周我实际上与另一个 package 有类似的问题。 You will probably have luck if you get a 3.7.5 install .如果您安装了 3.7.5 ,您可能会很幸运。 Make sure you get the right platform (x86 for 32-bit, x64 for 64 bit) and make sure you check the box to add it to your path.确保您获得了正确的平台(x86 用于 32 位,x64 用于 64 位)并确保选中该框以将其添加到您的路径中。

I'm guessing you're on Windows yes?我猜你在 Windows 是吗? If so then after the install open a powershell and enter gcm python and gcm pip to make sure they are being pulled from the 3.7 install.如果是这样,那么在安装后打开 powershell 并输入gcm pythongcm pip以确保它们是从 3.7 安装中拉出的。 If not, you'll have to edit PATH in the system environment variables and move the new Python37 directory before Python38 in your PATH.如果没有,您必须在系统环境变量中编辑 PATH 并将新的 Python37 目录移动到 PATH 中的 Python38 之前。

Hope that solves the issue!希望能解决问题!

Try to run pip install --pre -f https://sklearn-nightly.scdn8.secure.raxcdn.com scikit-learn .尝试运行pip install --pre -f https://sklearn-nightly.scdn8.secure.raxcdn.com scikit-learn . It worked for me.它对我有用。

The last pip install given above worked for me.上面给出的最后一个 pip 安装对我有用。 thanks谢谢

Try this in command prompt:在命令提示符下试试这个:

py -m pip install -U scikit-learn

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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