這裡将記錄開發中的常見問題
1.資料庫同步問題VerificationCode.expiration_time:
WARNINGS:
api.VerificationCode.expiration_time: (fields.W161) Fixed default value provided.
HINT: It seems you set a fixed date / time / datetime value as default for this field. This may not be what you want. If you want to have the current date as default, use `django.utils.timezone.now`
解決:
·
2. python bs4.FeatureNotFound
bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: lxml. Do you need to install a parser library?
問題所在:
bs4.featurenotfound:找不到具有您請求的功能的樹生成器:lxml。
解決方法:
pip install lxml
3. selenium.common.exceptions.WebDriverException: Message: 'chromedriver'
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
問題所在:
這是由于程式找不到 chromedriver 驅動
下載下傳 chromedriver http://chromedriver.storage.googleapis.com/index.html
注意版本:版本對照表 https://blog.csdn.net/BinGISer/article/details/88559532
4. selenium.common.exceptions.SessionNotCreatedException:
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 78
這是由于 ChromeDriver 和 Chrome 版本不對應
删除之前下載下傳的 chromedriver
重新下載下傳 chromedriver http://chromedriver.storage.googleapis.com/index.html
注意版本:版本對照表 https://blog.csdn.net/BinGISer/article/details/88559532
5. pip._vendor.urllib3.exceptions.ReadTimeoutError
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.
這是由于python 安裝第三方庫,逾時報錯--Read timed out.
pip install -i https://pypi.doubanio.com/simple pandas
pip --default-timeout=100000 install scrapy
6. RecursionError: maximum recursion depth exceeded while calling a Python object
RecursionError: maximum recursion depth exceeded while calling a Python object
遞歸錯誤:調用Python對象時超過了最大遞歸深度
python預設遞歸深度為1000,超過了就會報錯
其實這裡的"解決方法" 是不推薦的
這是我原本的代碼:
def func(n):
print(n)
func(n + 1)
func(1)
修改後的代碼:(這裡非常不推薦這樣修改)
import sys
sys.setrecursionlimit(99999999) # 不管數值多大,最多遞歸20963次
def func(n):
print(n)
func(n + 1)
func(1)
7. 'bool' object is not callable
問題描述:
在django項目中 删除資料時出現這個問題
問題所在:
這是由于該條資料和其他表中的資料有關聯
解決方法:
找到和這條資料有關的所有資料并删除,最後删除該條資料
8. python pip install face_recognition 失敗
python 安裝 face_recognition 子產品失敗
這是由于缺少依賴包導緻
pip install cmake
pip install face_recognition
9、ERROR: Could not build wheels for cryptography which use PEP 517 and cannot be installed directly
python 安裝 scrapy 失敗
解決方法:
1 python -m pip install --upgrade pip -i https://pypi.tuna.tsinghua.edu.cn/simple/
2 pip install scrapy -i https://pypi.tuna.tsinghua.edu.cn/simple/