Tag Archives: Computer Knowledge

[Solved] AttributeError: ‘PngImageFile‘ object has no attribute ‘imshow‘

How to solve error attributeerror:’pngimagefile’object has no attribute’imshow’ Successfully.


Error:

AttributeError: ‘PngImageFile’ object has no attribute ‘imshow’

Reasons:

Attribute error: the “pngimagefile” object does not have the attribute “imshow”

Solution:

Pngimagefile does not have imshow method, but has show method, so the following changes are required!

Modify
img.imshow()
to
img.show()

[Solved] matplotlib.units.ConversionError: Failed to convert value(s) to axis units: ‘LiR‘

 

solve the problem


No handles with labels found to put in legend.

Traceback (most recent call last):
  File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\backends\backend_qt5.py", line 508, in _draw_idle
    self.draw()
  File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\backends\backend_agg.py", line 388, in draw
    self.figure.draw(self.renderer)
  File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\artist.py", line 38, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\figure.py", line 1709, in draw
    renderer, self, artists, self.suppressComposite)
  File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\image.py", line 135, in _draw_list_compositing_images
    a.draw(renderer)
  File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\artist.py", line 38, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axes\_base.py", line 2647, in draw
    mimage._draw_list_compositing_images(renderer, self, artists)
  File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\image.py", line 135, in _draw_list_compositing_images
    a.draw(renderer)
  File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\artist.py", line 38, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\text.py", line 670, in draw
    bbox, info, descent = textobj._get_layout(renderer)
  File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\text.py", line 276, in _get_layout
    key = self.get_prop_tup(renderer=renderer)
  File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\text.py", line 831, in get_prop_tup
    x, y = self.get_unitless_position()
  File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\text.py", line 813, in get_unitless_position
    x = float(self.convert_xunits(self._x))
  File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\artist.py", line 180, in convert_xunits
    return ax.xaxis.convert_units(x)
  File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axis.py", line 1553, in convert_units
    f'units: {x!r}') from e
matplotlib.units.ConversionError: Failed to convert value(s) to axis units: 'LiR'
Traceback (most recent call last):
  File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axis.py", line 1550, in convert_units
    ret = self.converter.convert(x, self.units, self)
  File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\category.py", line 52, in convert
    'Missing category information for StrCategoryConverter; '
ValueError: Missing category information for StrCategoryConverter; this might be caused by unintendedly mixing categorical and numeric data
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\backends\backend_qt5.py", line 508, in _draw_idle
    self.draw()
  File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\backends\backend_agg.py", line 388, in draw
    self.figure.draw(self.renderer)
  File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\artist.py", line 38, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\figure.py", line 1709, in draw
    renderer, self, artists, self.suppressComposite)
  File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\image.py", line 135, in _draw_list_compositing_images
    a.draw(renderer)
  File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\artist.py", line 38, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axes\_base.py", line 2647, in draw
    mimage._draw_list_compositing_images(renderer, self, artists)
  File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\image.py", line 135, in _draw_list_compositing_images
    a.draw(renderer)
  File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\artist.py", line 38, in draw_wrapper
    return draw(artist, renderer, *args, **kwargs)
  File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\text.py", line 670, in draw
    bbox, info, descent = textobj._get_layout(renderer)
  File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\text.py", line 276, in _get_layout
    key = self.get_prop_tup(renderer=renderer)
  File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\text.py", line 831, in get_prop_tup
    x, y = self.get_unitless_position()
  File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\text.py", line 813, in get_unitless_position
    x = float(self.convert_xunits(self._x))
  File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\artist.py", line 180, in convert_xunits
    return ax.xaxis.convert_units(x)
  File "D:\ProgramData\Anaconda3\lib\site-packages\matplotlib\axis.py", line 1553, in convert_units
    f'units: {x!r}') from e
matplotlib.units.ConversionError: Failed to convert value(s) to axis units: 'LiR'

Error:
matplotlib.units.Conversion error: failed to convert value to axis unit: ‘LiR’

Solution:
matplotlib version is low, update the matplotlib library to version 3.3.2 or higher!

[Solved] SyntaxError: (unicode error) ‘unicodeescape‘ codec can‘t decode bytes in position 6-7: malformed

Successfully solved syntaxerror: (Unicode error) ‘Unicode eescape’ codec can’t decode bytes in position 6-7: malformed


solve the problem

input_image_path = ‘Inputs\Nnu01.jpg’
^
SyntaxError: (unicode error) ‘unicodeescape’ codec can’t decode bytes in position 6-7: malformed \N character escape

Solution ideas

Syntax error: (Unicode error) the ‘Unicode escape’ codec cannot decode bytes at positions 6-7: malformed\n character escape

Solution:

Escape character problem, caused by ‘\n’ in the string! You need to modify as follows, just add r in front!

input_image_path = r'Inputs\Nnu01.jpg'

OK, it’s done!

Error: an error occurred while performing the step: “building kernel modules”. See/var/log/NV

An ERROR occurred while performing the step: “Building kernel modules”. See /var/log/nv


To solve the problem
NVIDIA Software Installer for Unix/Linux
ERROR: An ERROR occurred while performing the step: “Building kernel modules”. See
/var/log/ nvidia-log for details.

solution
Error: An error occurred while performing the step “build a kernel module”. For more information, see /var/log/nvidia-installer.log.

The solution
First check the error log, the solution is really forgotten, really sorry……
PS: friends, really sorry, in the past for a long time, the specific solution to forget, I hope that friends, brainstorm, together to solve this problem, there is a better more detailed way, leave a message we discuss together! Thank you very much!

update
First of all, thank you for your recommendation!

Understand bugs: Nvidia drivers are “fragile.” Because of the execution of the apt-get Upgrade command, the kernel from 4.10 to 4.13, install the Nvidia driver will report an error, so put the kernel version back to 4.10 version, install again!

uname -r                       #Check the current kernel version
sudo apt-get remove linux-image-(version-number)-generic
For example
sudo apt-get remove linux-image-4.4.0-140-generic-generic # to remove the current kernel version



nvidia-smi # Use the command to view the GPU information after installing the graphics driver

Kernel version in the upgrade, will not delete the old version, just replace the old with the new version, only need to delete the new version of the kernel, the system will automatically descend to the old version, delete the new version of the kernel.

Unicode decodeerror: ‘UTF-8’ codec can’t decode byte 0xd3 in position 238: invalid continuation B

UnicodeDecodeError: ‘UTF-8’ codec can’t decode byte 0xD3 in position 238: invalid continuation B
 
directory
To solve the problem
solution
The solution


 
 
 
To solve the problem
UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xd3 in position 238: invalid continuation byte
 
 
solution
Unicode decoding error: “UTF-8” codec cannot decode byte 0xD3 in position 238: Continue byte invalid
 
 
The solution
Open the file in Python’s IDE, and add a line of code at the top!
# -*- coding: utf-8 -*-
or
# coding: utf8
 
 
 
 

Successfully resolved Unicode decodeerror: ‘UTF-8’ codec can’t decode byte 0xd3 in position 238: invalid continuation B

UnicodeDecodeError: ‘utF-8’ codec can’t decode byte 0xd3 in position 238: invalid Continuation B was successfully resolved
 
directory
To solve the problem
solution
The solution


 
 
 
To solve the problem
UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xd3 in position 238: invalid continuation byte
 
 
solution
Unicode decoding error: the “UTF-8” codec could not decode the byte 0xD3 in position 238: The continuing byte is invalid
 
 
The solution
Open the file in python’s IDE with a line of code at the top!
# -*- coding: utf-8 -*-
or
# coding: utf8
 
 
 
 

Successfully solved opencv error: assertion failed (SCN = = 3 | SCN = = 4) in CV:: cvtcolor

successfully resolve OpenCV Error: Assertion failed (SCN == 3 || SCN == 4) in CV ::cvtColor

directory

solve the problem

solution

solution


solve the problem

OpenCV Error: SCN == 3 || SCN == 4) in CV :cvtColor, file C:\projects\ OpenCV \modules\imgproc\ SRC \color. CPP, line 11111

Oserror: dlopen() failed to load a library: Cairo / cairo-2 / cairo-gobject-2/ cairo.so .2

successfully solved OSError: dlopen() failed to load a library: Cairo/Cairo -2/Cairo -gobject-2/Cairo. So.2

directory

solve the problem

solution

solution


solve the problem

raise OSError(“dlopen() failed to load a library: %s” % ‘/ ‘. Join (names))
OSError: dlopen() failed to load a library: Cairo/Cairo -2/Cairo -gobject-2/Cairo. So.2

solution

causes an operating system error (” dlopen () failed to load library: %s “%”/”. Join (names))
OS error: dlopen () failed to load library:

solution

reference foreign user method

installation GTK+ : GTK+ : introduction to GTK+, installation, and usage details

190517, the first time was ok, but after the second installation, the test did not succeed! It is urgent to solve



reference article: (appoints the original address to show thanks)
Getting “OSError: dlopen() failed to load a library: Cairo/Cairo -2” on Windows
pygal output PNG problem: dlopen() failed to load a library: Cairo/Cairo -2

How to Fix Parser rerror: error tokenizing data. C error: expected 2 fields in line 53, saw 3

successfully solved the File “pandas \ _libs \ parsers pyx”, line 2021, in pandas. _libs. Parsers. Raise_parser_error
pandas. Errors. ParserError: Error tokenizing data. C Error: Expected 2 fields in line 53, saw three </ p>

 

directory 

solve the problem

solution

solution


problem solving

File “pandas\_libs\parsers.pyx”, line 2021, in pandas._libs.parsers.raise_parser_error
pandas.errors.ParserError: Error tokenizing data. C error: Expected 2 fields in line 53, saw 3

 

solution

pandas. Errors. ParserError: parsing error: tag data error. C error: expect 2 fields in line 53, see 3

 

solution

because the CSV file is read, the default separation is comma. Analysis shows that the data read contains two fields in a certain cell, that is, two commas may be contained in the value.

,
data= pd.read_csv(data_file, error_bad_lines=False)