Error Messages:
RuntimeError: Invalid DISPLAY variable
Solution:
add the following codes
plt.switch_backend('agg')
after this line
import matplotlib.pyplot as plt
Done!
Error Messages:
RuntimeError: Invalid DISPLAY variable
Solution:
add the following codes
plt.switch_backend('agg')
after this line
import matplotlib.pyplot as plt
Done!
Error code:
The defined method is a static function. In fact, the function content is not static, so an error occurs when calling. Just delete @ staticmethod.
Correct code:
Problem Description:
Using Python package CX_ When setting scheduled tasks on the Oracle server, errors are always reported, such as the title, but running alone is no problem
resolvent:
Under the guidance of the boss, add a few lines of code in front of the script to solve the problem perfectly. The environment variable path is configured according to its own path.
import os
os.environ["ORACLE_HOME"] = '/home/oracle/app/oracle/product/11.2.0/dbhome_1'
os.environ["ORACLE_BASE"] = '/home/oracle/app/oracle'
os.environ["ORACLE_SID"] = 'orcl'
os.environ["LD_LIBRARY_PATH"] = '/home/oracle/app/oracle/product/11.2.0/dbhome_1/lib:/lib:/usr/lib'
This error is usually caused by the mismatch of numpy versions, and the related MKL libraries are also uninstalled
pip unstall numpy
pip unstall mkl-service
Then PIP reinstall it
I just don’t know why I can’t solve it with CONDA uninstall + reinstall. Just replace it with PIP. It seems that there is a difference between uninstall and installed library?
Record:
Today, I saw the interface document provided by others. When parsing the text, I used urllib.quote In the end, we found that it was a version problem. The way to write python2 is urllib.quote , python3 should be changed to urllib.parse.quote That’s it.
If you want to set the same initial value and desired length
>>> a=[None]*4
>>> print(a)
[None, None, None, None]
If we know the length of the list in advance, we can initialize the list of that length in advance, and then assign values to each list, which will be faster than each time list.append () more efficient.
If you want the sequence initial value, you can use the range function, but note that the range function returns an iterative object, which needs to be converted into a list
>>> b=list(range(10))
>>> print(b)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> b=range(10)
>>> print(b)
range(0, 10)
If you want to eliminate unwanted data, you can use the list derivation
>>> c=[i for i in range(10) if i%2==0 and i<8]
>>> print(c)
[0, 2, 4, 6]
Life is short, You need Python~
python manage.py migrate
‘can’t open file ‘manage.py’: [Errno 2] No such file or directory’ can’t open file ‘manage.py’: [Errno 2] No such file or directory ‘can’t open file ‘manage.py’: [Errno 2] No such file or directory’
Django-admin.py: django-admin.py: django-admin.py: django-admin.py: django-admin.py: django-admin.py: django-admin.py: django-admin.py: django-admin.py: django-admin.py: django-admin.py: django-admin.py: django-admin.py: django-admin.py: django-admin.py: django-admin.py:
django-admin.py startproject student_project .
4, then report the above described error, the reason: in fact, the path is wrong, did not set the soft connection. F:\python_stu\student_project\stu_env\Lib\site-packages\ Django \bin. Django-admin.py: F:\python_stu\student_project\stu_env\Lib\site-packages\ Django \bin.
python F:\python_stu\student_project\stu_env\Lib\site-packages\django\bin\django-admin.py startproject student_project
The above content is only for your reference, thank you!