When running detect.py for inference testing after yolov5 training is complete, this error occurs:
The specific error is as follows:
Solution:
1. Click the error reporting method below to enter:
2. Modify to the following code:
Done!
When running detect.py for inference testing after yolov5 training is complete, this error occurs:
The specific error is as follows:
Solution:
1. Click the error reporting method below to enter:
2. Modify to the following code:
Done!
Question:
Using bar in Matplotlib_ An error was encountered in the label function:
attributeerror: 'axessubplot' object has no attribute 'bar_ label'
resolvent:
Because the version of Matplotlib is too low, you need to reinstall Matplotlib (enter the following command in the console)
① Uninstall Matplotlib
conda uninstall matplotlib
② Download again
pip install matplotlib
AttributeError encountered when executing gnocchi metric list related commands using ceilometer and gnocchi: _Environ instance has no attribute ‘。
Control node execution: gnocchi metric list
Traceback (most recent call last):
File “/usr/bin/gnocchi”, line 10, in
sys.exit(main())
File “/usr/lib/python2.7/site-packages/gnocchiclient/shell.py”, line 252, in main
return GnocchiShell().run(args)
File “/usr/lib/python2.7/site-packages/gnocchiclient/shell.py”, line 99, in init
deferred_help=True,
File “/usr/lib/python2.7/site-packages/cliff/app.py”, line 79, in init
self.parser = self.build_option_parser(description, version)
File “/usr/lib/python2.7/site-packages/gnocchiclient/shell.py”, line 130, in build_option_parser
os.environ.set(“OS_AUTH_TYPE”, “password”)
AttributeError: _Environ instance has no attribute ‘set’
Solution:
vi keystonerc_admin
Modify
unset OS_SERVICE_TOKEN
export OS_USERNAME=admin
export OS_PASSWORD=‘openstack password’
export OS_REGION_NAME=RegionOne
export OS_AUTH_URL=http://x.x.x.x:5000/v3
export PS1=’[\u@\h \W(keystone_admin)]$ ’
export OS_PROJECT_NAME=admin
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_DOMAIN_NAME=Default
export OS_IDENTITY_API_VERSION=3
export OS_PLACEMENT_API_VERSION=1.17
export OS_AUTH_TYPE=password
At this point the following command can be used in the terminal:
source ~/keystonerc_admin
gnocchi metric list
gnocchi metric list | grep cpu
gnocchi resource list
gnocchi resource list --type image
gnocchi measures show 839afa02-1668-4922-a33e-6b6ea7780715
Python script error attributeerror: ‘module’ object has no attribute ‘xxx’ solution
when you encounter a few problems, you should pay attention to the same problem when you don’t ask for a solution
1. When naming py script, it should not be the same as the reserved word and module name of Python
(it is not easy to notice when naming files)
2 Delete the. PyC file of the library (because the. PyC file will be generated every time the PY script runs; if the. PyC file has been generated, if the code is not updated, the runtime will still go PyC, so you need to delete the. PyC file), rerun the code, or find an environment where you can run the code and copy and replace the. PyC file of the current machine Import questions </ font> </ font>
Error report: in the front-end test, the interface sends a put request, the error report occurs on the interface, the request cannot respond, and the server status code is 500.
Error analysis: semantically, “the object does not have a XXX attribute.”.
Look up most of the information, most of the problems with Python. The front end of this project uses react, and the back end uses the djongo framework of Python.
The main reason for asking the back-end colleagues is that the data type of the parameters passed by the front-end is incorrect. The back end needs a string “true”, but the front end passes a Boolean “true”, which causes the above problem.
In case of such a problem, the error code returned by the server is 500. For such a problem, usually ask the back-end colleagues to check the log for common analysis.
Using urllib in Python 3 is an error like this:
Traceback (most recent call last):
File "*.py", line 34, in <module>
html_page = get(URL, req_header)
File "*.py", line 18, in get_HTML
request = urllib.request.Request(url, headers=req_header)
AttributeError: module 'urllib' has no attribute 'request'
An error code
import urllib
request = urllib.request.Request(url, headers=req_header)
html = urllib.request.urlopen(request).read()
print (html)
Error reason:
in the Python AttributeError code> errors there are two kinds of main reason:
>
1.
2. File with same name exists in project directory
> port urllib.request
<>ode>
import urllib
import urllib.request
request = urllib.request.Request(url, headers=req_header)
html = urllib.request.urlopen(request).read()
print (html)