问题描述
我是一个新的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 oneIs 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:
- 卸载 scikit-learn:
conda remove scikit-learn
或pip uninstall scikit-learn
.您可以使用pip list
和conda list
检查它是否被正确删除. - 选择您想要存放 scikit-learn 文件的目录.
- 从这个目录,用git从github下载代码:
git clone git://github.com/scikit-learn/scikit-learn.git
- 使用 pip 以可编辑的方式安装它:
pip install --editable .
- Uninstall scikit-learn:
conda remove scikit-learn
orpip uninstall scikit-learn
. You can check that it's correctly removed, withpip list
andconda list
. - Choose a directory where you want to have the scikit-learn files.
- From this directory, download the code from github with git:
git clone git://github.com/scikit-learn/scikit-learn.git
- 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 代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!