Python turicreate windows(wsl ubuntu)无法打开csv文件进行读取

Python turicreate windows(wsl ubuntu)无法打开csv文件进行读取,python,jupyter-notebook,turi-create,Python,Jupyter Notebook,Turi Create,我在windows上安装了wsl Ubuntu20.04 LTS版本来使用turicreate。但是我在使用csv文件时遇到了一些问题,我将它从下载文件夹移到了venv文件夹所在的/home/user。在第一行我!pip安装turicreate和ran要求已满足,然后导入turicreate和ran sf = turicreate.SFrame(r'people-example.csv') 并且得到了 OSError Trac

我在windows上安装了wsl Ubuntu20.04 LTS版本来使用turicreate。但是我在使用csv文件时遇到了一些问题,我将它从下载文件夹移到了venv文件夹所在的/home/user。在第一行我!pip安装turicreate和ran要求已满足,然后导入turicreate和ran

sf = turicreate.SFrame(r'people-example.csv')
并且得到了

OSError                                   Traceback (most recent call last)
~/MLvenv/lib/python3.8/site-packages/turicreate/data_structures/sframe.py in _read_csv_impl(cls, url, delimiter, header, error_bad_lines, comment_char, escape_char, double_quote, quote_char, skip_initial_space, column_type_hints, na_values, line_terminator, usecols, nrows, skiprows, verbose, store_errors, nrows_to_infer, true_values, false_values, _only_raw_string_substitutions, **kwargs)
   1093             with cython_context():
-> 1094                 errors = proxy.load_from_csvs(internal_url, parsing_config, type_hints)
   1095         except Exception as e:

cy_sframe.pyx in turicreate._cython.cy_sframe.UnitySFrameProxy.load_from_csvs()

cy_sframe.pyx in turicreate._cython.cy_sframe.UnitySFrameProxy.load_from_csvs()

OSError: Cannot open /home/anagene/people-example.csv for read. Cannot open /home/anagene/people-example.csv for reading

During handling of the above exception, another exception occurred:

OSError                                   Traceback (most recent call last)
~/MLvenv/lib/python3.8/site-packages/turicreate/data_structures/sframe.py in __init__(self, data, format, _proxy)
    825                     url = data
--> 826                     tmpsf = SFrame.read_csv(url, delimiter=",", header=True)
    827                     self.__proxy__ = tmpsf.__proxy__

~/MLvenv/lib/python3.8/site-packages/turicreate/data_structures/sframe.py in read_csv(cls, url, delimiter, header, error_bad_lines, comment_char, escape_char, double_quote, quote_char, skip_initial_space, column_type_hints, na_values, line_terminator, usecols, nrows, skiprows, verbose, nrows_to_infer, true_values, false_values, _only_raw_string_substitutions, **kwargs)
   1555 
-> 1556         return cls._read_csv_impl(
   1557             url,

~/MLvenv/lib/python3.8/site-packages/turicreate/data_structures/sframe.py in _read_csv_impl(cls, url, delimiter, header, error_bad_lines, comment_char, escape_char, double_quote, quote_char, skip_initial_space, column_type_hints, na_values, line_terminator, usecols, nrows, skiprows, verbose, store_errors, nrows_to_infer, true_values, false_values, _only_raw_string_substitutions, **kwargs)
    985                 # Get the first nrows_to_infer rows (using all the desired arguments).
--> 986                 first_rows = SFrame.read_csv(
    987                     url,

~/MLvenv/lib/python3.8/site-packages/turicreate/data_structures/sframe.py in read_csv(cls, url, delimiter, header, error_bad_lines, comment_char, escape_char, double_quote, quote_char, skip_initial_space, column_type_hints, na_values, line_terminator, usecols, nrows, skiprows, verbose, nrows_to_infer, true_values, false_values, _only_raw_string_substitutions, **kwargs)
   1555 
-> 1556         return cls._read_csv_impl(
   1557             url,

~/MLvenv/lib/python3.8/site-packages/turicreate/data_structures/sframe.py in _read_csv_impl(cls, url, delimiter, header, error_bad_lines, comment_char, escape_char, double_quote, quote_char, skip_initial_space, column_type_hints, na_values, line_terminator, usecols, nrows, skiprows, verbose, store_errors, nrows_to_infer, true_values, false_values, _only_raw_string_substitutions, **kwargs)
   1093             with cython_context():
-> 1094                 errors = proxy.load_from_csvs(internal_url, parsing_config, type_hints)
   1095         except Exception as e:

~/MLvenv/lib/python3.8/site-packages/turicreate/_cython/context.py in __exit__(self, exc_type, exc_value, traceback)
     49                 # To hide cython trace, we re-raise from here
---> 50                 raise exc_type(exc_value)
     51             else:

OSError: Cannot open /home/anagene/people-example.csv for read. Cannot open /home/anagene/people-example.csv for reading

During handling of the above exception, another exception occurred:

OSError                                   Traceback (most recent call last)
<ipython-input-8-d54163f18f67> in <module>
----> 1 sf = turicreate.SFrame(r'people-example.csv')

~/MLvenv/lib/python3.8/site-packages/turicreate/data_structures/sframe.py in __init__(self, data, format, _proxy)
    836                     pass
    837                 else:
--> 838                     raise ValueError("Unknown input type: " + format)
    839 
    840     @staticmethod

~/MLvenv/lib/python3.8/site-packages/turicreate/_cython/context.py in __exit__(self, exc_type, exc_value, traceback)
     48             if not self.show_cython_trace:
     49                 # To hide cython trace, we re-raise from here
---> 50                 raise exc_type(exc_value)
     51             else:
     52                 # To show the full trace, we do nothing and let exception propagate

OSError: Cannot open /home/anagene/people-example.csv for read. Cannot open /home/anagene/people-example.csv for reading
OSError回溯(最近一次调用)
~/MLvenv/lib/python3.8/site-packages/turicreate/data\u structures/sframe.py in\u read\u csv\u impl(cls、url、分隔符、标题、错误行、注释行、转义行、双引号、引号行、跳过初始空格、列类型提示、na值、行终止符、usecols、nrows、skiprows、verbose、存储错误、nrows到推断、真值、假值、仅原始字符串替换、**kwargs)
1093和cython_context():
->1094 errors=proxy.load\u from\u csv(内部\u url、解析\u配置、键入\u提示)
1095例外情况除外,如e:
turicreate中的cy\u sframe.pyx.\u cython.cy\u sframe.UnitySFrameProxy.load\u from\u csvs()
turicreate中的cy\u sframe.pyx.\u cython.cy\u sframe.UnitySFrameProxy.load\u from\u csvs()
OSError:无法打开/home/managene/people-example.csv进行读取。无法打开/home/managene/people-example.csv进行读取
在处理上述异常期间,发生了另一个异常:
OSError回溯(最近一次调用上次)
~/MLvenv/lib/python3.8/site-packages/turicreate/data\u structures/sframe.py in\uuuuuuu init\uuuuuu(self,data,format,\u proxy)
825 url=数据
-->826 tmpsf=SFrame.read_csv(url,delimiter=“,”,header=True)
827 self.\uuuu proxy.\uuuu=tmpsf.\uuuu proxy__
读取csv中的~/MLvenv/lib/python3.8/site-packages/turicreate/data\u structures/sframe.py(cls、url、分隔符、标题、错误行、注释行、转义行、双引号、引号行、跳过初始空格、列类型提示、na值、行终止符、usecols、nrows、skiprows、verbose、nrows到推断、真值、假值、仅原始字符串替换、**kwargs)
1555
->1556返回cls.\u读取\u csv\u执行(
1557网址,
~/MLvenv/lib/python3.8/site-packages/turicreate/data\u structures/sframe.py in\u read\u csv\u impl(cls、url、分隔符、标题、错误行、注释行、转义行、双引号、引号行、跳过初始空格、列类型提示、na值、行终止符、usecols、nrows、skiprows、verbose、存储错误、nrows到推断、真值、假值、仅原始字符串替换、**kwargs)
985 35;获取第一个nrows_来推断行(使用所有所需参数)。
-->986第一行=SFrame.read\u csv(
987网址,
读取csv中的~/MLvenv/lib/python3.8/site-packages/turicreate/data\u structures/sframe.py(cls、url、分隔符、标题、错误行、注释行、转义行、双引号、引号行、跳过初始空格、列类型提示、na值、行终止符、usecols、nrows、skiprows、verbose、nrows到推断、真值、假值、仅原始字符串替换、**kwargs)
1555
->1556返回cls.\u读取\u csv\u执行(
1557网址,
~/MLvenv/lib/python3.8/site-packages/turicreate/data\u structures/sframe.py in\u read\u csv\u impl(cls、url、分隔符、标题、错误行、注释行、转义行、双引号、引号行、跳过初始空格、列类型提示、na值、行终止符、usecols、nrows、skiprows、verbose、存储错误、nrows到推断、真值、假值、仅原始字符串替换、**kwargs)
1093和cython_context():
->1094 errors=proxy.load\u from\u csv(内部\u url、解析\u配置、键入\u提示)
1095例外情况除外,如e:
~/MLvenv/lib/python3.8/site-packages/turicreate//u cython/context.py in\uuu\u退出(self,exc\u类型,exc\u值,回溯)
49#为了隐藏cython的踪迹,我们从这里升起
--->50提升exc_类型(exc_值)
51.其他:
OSError:无法打开/home/managene/people-example.csv进行读取。无法打开/home/managene/people-example.csv进行读取
在处理上述异常期间,发生了另一个异常:
OSError回溯(最近一次调用上次)
在里面
---->1sf=turicreate.SFrame(r'people-example.csv')
~/MLvenv/lib/python3.8/site-packages/turicreate/data\u structures/sframe.py in\uuuuuuu init\uuuuuu(self,data,format,\u proxy)
836通行证
837其他:
-->838提升值错误(“未知输入类型:+格式”)
839
840@staticmethod
~/MLvenv/lib/python3.8/site-packages/turicreate//u cython/context.py in\uuu\u退出(self,exc\u类型,exc\u值,回溯)
48如果不是self.show\u cython\u trace:
49#为了隐藏cython的踪迹,我们从这里升起
--->50提升exc_类型(exc_值)
51.其他:
52#为了显示完整的跟踪,我们什么也不做,让异常传播
OSError:无法打开/home/managene/people-example.csv进行读取。无法打开/home/managene/people-example.csv进行读取

也有同样的问题,通过在ubuntu上执行以下代码,让每个人都可以访问文件,从而解决了这个问题: sudo chmod a+rwx/home/managene/people-example.csv,其中后一部分是文件路径


将文件名a/c更改为您的查询,以便您可以直接使用上述代码。

有完全相同的问题,通过在ubuntu上执行以下代码向所有人提供文件访问权限来解决: sudo chmod a+rwx/home/managene/people-example.csv,其中后一部分是文件路径

将文件名a/c更改为您的查询,以便您可以直接使用上述代码