一邊學習一邊更新
1.Pycharm下載各種包超時(Read time out)
根本原因是pip install xxx默認訪問外網https://files.pythonhosted.org/packages下載,速度賊慢。
試了各種方法,吐血經歷,將下載地址換到國內鏡像纔是最好的解決方案。
pip install xxx -i https://mirrors.aliyun.com/pypi/simple/
國內鏡像可以用下面任一個:
阿里雲 https://mirrors.aliyun.com/pypi/simple/
中國科技大學 https://pypi.mirrors.ustc.edu.cn/simple/
清華大學 https://pypi.tuna.tsinghua.edu.cn/simple/
中國科學技術大學 https://pypi.mirrors.ustc.edu.cn/simple/
一勞永逸的方法是:(windows下)
- 在C:\Users\xxx\目錄下創建一個pip目錄
- 進入pip文件夾(C:\Users\xxx\pip),新建.txt文檔重命名爲pip.ini
- 打開pip.ini(使用Notepad++或者其它),粘貼以下內容,鏡像網址可以選擇上述任一
[global]
index-url = https://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=pypi.doubanio.com
- 在環境便量中(我的電腦>右鍵屬性>高級系統設置>環境變量>系統變量>Path中)添加 %HOME%\pip\pip.ini
2.Tensorflow運行時警告FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.np_resource = np.dtype([("resource", np.ubyte, 1)])
numpy版本高的原因,重裝numpy 1.16就可以
在Pycharm中file>setting>Project xxx>Project Interpreter雙擊列表裏的numpy勾選Specify version選擇版本
3.Tensorboard瀏覽器查看日誌時打不開http://127.0.0.1:6006
- 編寫有生成日誌的代碼(寫過纔會有這個問題吧)
- 啓動tensorboard:win+R打開cmd,cd [你的日誌目錄] (這裏是日誌文件所在的目錄,與一般教程裏說的日誌上一級目錄不同)
- 接着輸入命令:
tensorboard --logdir ./ --host=127.0.0.1
- 瀏覽器中打開http://127.0.0.1:6006即可
成功後
4.Cannot open .\Scripts\pip-script.py
重裝pip:
easy_install pip
或者恢復pip版本信息:
easy_install -U pip==19.1.1
5. 編譯pycocotools出現Unable to find vcvarsall.bat
在構建coco的相關環境時,調用vcvarsall.bat,出現這樣的錯誤。原因是缺少vc++的相關工具。
簡單易行的解決方案,下載VisualCppBuildTools_Full.exe,等待安裝完成。
6.python matplotlib中是用figure()報錯ValueError: max() arg is an empty sequence
可能是pycharm的tool window裏的圖像顯示不支持動態顯示圖像(因爲plt.plot()是正常的)
在菜單欄File-Setting-Tools-Python Scientific中去除勾選Show plots in tool window即可
7.Windows下python3.5安裝MySQLdb
pip install ...報錯:failed with error code 1 in...
正確方式:
pip3 install mysqlclient==1.3.10