Python 踩過的坑

2021-09-29 08:37:38 字數 658 閱讀 4782

unicodedecodeerror: 'utf-8' codec can't decode bytes in position 15-16: invalid continuation byte 

case:with open("d:/360movedata/users/2506/desktop/asrs data/result-synopis.xlsx", "r",encoding = 'utf8') as f:

solution:"r" into "rb"

opencv error: (-215)size.width>0 && size.height>0 in function imshow

或者cv2.imread always returns nonetype 

這樣的問題時,可以嘗試以下的解決方案:

(1)可能是你的opencv版本過低的原因

在控制台進行安裝  pip install --upgrade opencv-python

(2)可能是你import的影象儲存路徑的原因

錯誤:c:\users\2506\desktop\2nd *****\demo1.jpg

正確:c:/users/2506/desktop/2nd *****/demo1.jpg

Python中踩過的坑

1,利用win32呼叫spk語音,只能在main中呼叫 2,打包專案不能執行,試試 pyinstaller fw main.py p venv lib site packages f 強制打包成.exe檔案,沒有資料夾的 w 不要小黑窗 p 指定庫路徑,不能執行關鍵就是少了這引數 3,json庫,神...

git踩過的坑

4.git 修改當前的project的使用者名稱的命令為 git config user.name 你的目標使用者名稱 git 修改當前的project提交郵箱的命令為 git config user.email 你的目標郵箱名 如果你要修改當前全域性的使用者名稱和郵箱時,需要在上面的兩條命令中新增...

springboot踩過的坑

設定上下文路徑context path不生效 springboot 2.0之前的語法 server.context path xx 2.0之後的語法 server.servlet.context path xx 在配置yml時,報錯如下 caused by org.yaml.snakeyaml.sc...