建立distutils会产生TypeError:期望的str,bytes或os.PathLike对象,而不是list

时间:2017-08-18 14:28:40

标签: python scikit-learn cython distutils

我正在尝试构建sklearn.tree子包,其中包含一些Cython代码。我在Windows上使用Python 3.6.1和Numpy 1.12.1。

文件setup.py(可以下载here)包含带有代码的distutils配置,例如 config.add_extension("_tree", sources=["_tree.pyx"],...) 所以我希望sources(这个变量翻转下面列出的一长串函数)是一个字符串列表。

但是,在尝试构建软件包时,我会收到下面列出的输出。这意味着sourcebuild_src.py的函数sourcessetup.py的元素,不是字符串而是列表。

所以问题是:

  1. 字符串确实变成了一个列表;如果是的话,在哪里?
  2. 这个错误是由我构建模块的方式引起的;如果是的话,如何正确构建它?
  3. 这个错误是由写 C:\Users\ddale\Downloads\scikit-learn-master\sklearn\tree>python setup.py build_ext Appending tree.tests configuration to tree Ignoring attempt to set 'name' (from 'tree' to 'tree.tests') running build_ext running build_src build_src building extension "tree._tree" sources Warning: Assuming default configuration (tests/{setup_tests,setup}.py was not found)Traceback (most recent call last): File "setup.py", line 39, in <module> setup(**configuration_old().todict()) File "C:\Users\ddale\AppData\Local\Continuum\Anaconda3\lib\site-packages\numpy\distutils\core.py", line 166, in setup return old_setup(**new_attr) File "C:\Users\ddale\AppData\Local\Continuum\Anaconda3\lib\distutils\core.py", line 148, in setup dist.run_commands() File "C:\Users\ddale\AppData\Local\Continuum\Anaconda3\lib\distutils\dist.py", line 955, in run_commands self.run_command(cmd) File "C:\Users\ddale\AppData\Local\Continuum\Anaconda3\lib\distutils\dist.py", line 974, in run_command cmd_obj.run() File "C:\Users\ddale\AppData\Local\Continuum\Anaconda3\lib\site-packages\numpy\distutils\command\build_ext.py", line 82, in run self.run_command('build_src') File "C:\Users\ddale\AppData\Local\Continuum\Anaconda3\lib\distutils\cmd.py", line 313, in run_command self.distribution.run_command(command) File "C:\Users\ddale\AppData\Local\Continuum\Anaconda3\lib\distutils\dist.py", line 974, in run_command cmd_obj.run() File "C:\Users\ddale\AppData\Local\Continuum\Anaconda3\lib\site-packages\numpy\distutils\command\build_src.py", line 148, in run self.build_sources() File "C:\Users\ddale\AppData\Local\Continuum\Anaconda3\lib\site-packages\numpy\distutils\command\build_src.py", line 165, in build_sources self.build_extension_sources(ext) File "C:\Users\ddale\AppData\Local\Continuum\Anaconda3\lib\site-packages\numpy\distutils\command\build_src.py", line 330, in build_extension_sources sources, py_files = self.filter_py_files(sources) File "C:\Users\ddale\AppData\Local\Continuum\Anaconda3\lib\site-packages\numpy\distutils\command\build_src.py", line 390, in filter_py_files return self.filter_files(sources, ['.py']) File "C:\Users\ddale\AppData\Local\Continuum\Anaconda3\lib\site-packages\numpy\distutils\command\build_src.py", line 399, in filter_files (base, ext) = os.path.splitext(source) File "C:\Users\ddale\AppData\Local\Continuum\Anaconda3\lib\ntpath.py", line 223, in splitext p = os.fspath(p) TypeError: expected str, bytes or os.PathLike object, not list 的方式引起的吗?如果是这样,如何改变呢? sklearn的开发人员是如何使用它的?
  4. 这个错误是由我的环境造成的吗?如果是这样,我应该改变什么?
  5. const createActions = (function (config, options) { if (R.isNil(config)) { throw new Error('an object is required to setup types and creators'); } if (R.isEmpty(config)) { throw new Error('empty objects are not supported'); } return { Types: convertToTypes(config, options), Creators: convertToCreators(config, options) }; }) let results = createActions({ userRequest: ['username'], userSuccess: ['avatar'], userFailure: null }), Types = results.Types, Creators = results.Creators;

0 个答案:

没有答案