简体   繁体   中英

how to resolve error in installing pycsv in python3.7?

as I'm doing this code and need the CSV library to execute this.

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:

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. 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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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