简体   繁体   English

如何解决在python3.7中安装pycsv时出错?

[英]how to resolve error in installing pycsv in python3.7?

as I'm doing this code and need the CSV library to execute this.因为我正在执行此代码并且需要 CSV 库来执行此操作。

import csv

class CsvWordReplacer(WordReplacer):
    def __init__(self, fname):
        word_map = {}
        for line in csv.reader(open(fname)):
            word, syn = line
            word_map[word] = syn
            super(CsvWordReplacer, self).__init__(word_map)
replacer = CsvWordReplacer('synonyms.csv')
a=replacer.replace('bday')

while installing the library in Python 3.7 using pyserial3.2 by giving the command in cmd(administrator) as:通过在 cmd(administrator) 中给出命令,使用pyserial3.2Python 3.7 中安装库时:

pip install --user pycsv

I found the following error:我发现以下错误:

 Traceback (most recent call last):
      File "<string>", line 1, in <module>
        long_description=io.open("history.md", encoding='utf8').read(),
    FileNotFoundError: [Errno 2] No such file or directory: 'history.md'

if anyone could help me out that would be great.如果有人可以帮助我,那就太好了。

You don't need install the csv library module.您不需要安装csv库模块。 It is part of the standard library.它是标准库的一部分。 Uninstall pycsv (which, according to its own documentation on PyPI, does not support Python 3, and was last updated over 3 years ago) and just use csv .卸载pycsv (根据它自己关于 PyPI 的文档,它不支持 Python 3,并且最近一次更新是在 3 年前)并只使用csv

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM