在本地修改 scikit-learn 代码 [英] Modifying scikit-learn code locally

查看:53
本文介绍了在本地修改 scikit-learn 代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个新的python程序员,我刚刚在anaconda3的model_selection文件夹中更改了一个原始的python文件

I am a new python programmer and I just changed an original python file in model_selection folder in anaconda3

但是,当我运行代码时,它运行的是原始版本而不是新版本有没有我可以运行的代码来使这些更改生效

However, when I run the code it run the original version not the new one Is there any code I can run to make these changes take a place

完整的回溯:

Command "C:\Users....\AppData\Local\Continuum\Anaconda3\python.exe -c "import setuptools, tokenize;file='C:\Users\...\scikit-learn\setup.py';f‌ =getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" develop --no-deps" failed with error code 1 in C:\Users...\scikit-learn\ –

Command "C:\Users....\AppData\Local\Continuum\Anaconda3\python.exe -c "import setuptools, tokenize;file='C:\Users\...\scikit-learn\setup.py';f‌​=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" develop --no-deps" failed with error code 1 in C:\Users...\scikit-learn\ –

谢谢

推荐答案

您可能不应该更改 anaconda 文件夹中的代码.如果您想对 scikit-learn 代码进行更改(为您自己),最好的方法是:

You should probably not change the code in anaconda folders. If you want to make changes to scikit-learn code (for yourself), the best way is to:

  1. 卸载 scikit-learn:conda remove scikit-learnpip uninstall scikit-learn.您可以使用 pip listconda list 检查它是否被正确删除.
  2. 选择您想要存放 scikit-learn 文件的目录.
  3. 从这个目录,用git从github下载代码:git clone git://github.com/scikit-learn/scikit-learn.git
  4. 使用 pip 以可编辑的方式安装它:pip install --editable .
  1. Uninstall scikit-learn: conda remove scikit-learn or pip uninstall scikit-learn. You can check that it's correctly removed, with pip list and conda list.
  2. Choose a directory where you want to have the scikit-learn files.
  3. From this directory, download the code from github with git: git clone git://github.com/scikit-learn/scikit-learn.git
  4. Install it in an editable fashion with pip: pip install --editable .

然后将应用对代码所做的任何编辑.请注意,如果您编辑 Cython/C 代码(.pyx 或 .c 文件),则必须在更改发生之前使用 python setup.py build_ext --inplace

Then any edit done on the code will be applied. Note that if you edit Cython/C code (.pyx or .c files), you will have to recompile them before the changes take place, using python setup.py build_ext --inplace

这篇关于在本地修改 scikit-learn 代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆