廖雪峯Python入門教程中的learning.py運行時提示報錯python
This learning.py is expired. Please download a newer version.
因爲提示內容是過時,因此先打開learning.py 能夠看到代碼中有這麼幾行:日誌
# check ####################################################################### import sys from datetime import datetime CERT_EXPIRES = '2017-07-01' def check_version(): v = sys.version_info if v.major == 3 and v.minor >= 5: return print('Your current python is %d.%d. Please use Python 3.6.' % (v.major, v.minor)) exit(1) def check_cert(): today = datetime.now().strftime('%Y-%m-%d') if today >= CERT_EXPIRES: print('This learning.py is expired. Please download a newer version.') exit(1) check_version() check_cert()
這裏有設置過時時間爲"CERT_EXPIRES = '2017-07-01'",下面有檢查當前系統日期,若是當前系統日誌大於過時時間,則會提示此報錯,同時,還有一個判斷:若是當前Python版本低於3.則也會提示請下載最新版本的Python。因此,修改learning.py中的過時時間便可。code
修改時間教程
CERT_EXPIRES = '2017-07-01'
大於當前時間便可。
修改後再運行,一切正常。it