运行setup.py install进行scikit-learn ...错误

时间:2019-11-14 05:14:07

标签: scikit-learn

我正在使用MacOs Mojave,目前正在尝试运行GitHub上this链接上的项目。我已经安装了最新版本的python(即python 3.8),当前在安装需求时遇到问题,主要是在scikit-learn中。无论哪种方式,我都会遇到相同的错误。

请帮助我彻底在本地计算机上完全运行此项目。

enter image description here

我还在GitHub主页上提出了一个与此有关的问题,但仍在等待适当的答复。

当我尝试根据给定的说明和在stackoverflow上的可用答案安装cython时,我在python3.8中使用命令pip3 install --upgrade cython得到了另一个大错误页面,如答案中所述。我在这里附上错误消息。 enter image description here enter image description here enter image description here enter image description here enter image description here enter image description here 这是我之后遇到的完整错误集。 在此先感谢您是否可以使用python3.8指导我完成该项目

感谢VonC解决了cython的安装问题。现在,在我的系统中使用python3.8安装scikit-learn时遇到的另一个错误是: scikit-learn installation error with python3.8 正如@VonC回答的那样,我确实尝试遵循链接enter link description here,现在在执行命令 pip install --verbose --editable 时。现在,我得到了another error here 请帮助我。我已经使用Homebrew

安装了LLVM OpenMP库。

2 个答案:

答案 0 :(得分:1)

在其他项目:CellProfiler/centrosome issue 78中看到了

no module named Cython”,并且有多种解决方法:

python3 setup.py install
# and/or
python3.6 -m pip install --upgrade cython
sudo python3.6 -m pip install --upgrade cython
# and/or
pip install --upgrade cython
  

如果您使用的是python 2.7或更高版本,请在终端上输入:pip install --upgrade cython
  应该可以的。
  该错误可能是因为从cython安装的pip版本与您系统上的python版本不兼容。

如果导致以下情况:

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools)

然后检查this question,并尝试更新XCode:xcode-select --install


关于scikit-learn错误,是:

  

似乎无法使用OpenMP支持构建scikit-learn。

     
      
  • 确保已按照安装说明进行操作:
  •   
     

https://scikit-learn.org/dev/developers/advanced_installation.html

有一个issue about this error

  

好像是sklearn/_build_utils/openmp_helpers.py中错误的结果。
  对我而言,测试程序./test_openmp.c可以正常运行,但在构建Scikit学习过程中却无法正常工作。

     

因此,我只将False中第111行的True替换为openmp_helpers.py(例如sed -i -e '111s/False/True/')。
  结果,我可以正常构建Scikit-learn 0.21.3

还有from instructions for Mac

  

使用Homebrew安装libomp,以扩展默认的Apple clang编译器。

     

我尝试了第二种选择,以通过Homebrew安装libomp
  它像魅力一样运作。

如果看到“ File "setup.py" not found”,则表示未在正确的文件夹中执行pip命令。
如果您是installing from sources,则应在克隆了上述来源的位置(应在pip install --verbose --editable .的位置键入conda activate sklearn-dev(在setup.py之后)

答案 1 :(得分:0)

您只需要先安装pip install -U scikit-learn 。使用:

pip3 install -U scikit-learn

OR

{{1}}