!python /content/drive/My\ Drive/BertNer/BERT_NER.py
要特别注意当前工作目录,使用以下命令进入当前目录
%cd /content/gdrive/My\ Drive/yourfilename
查看当前版本
!pip3 show tensorflow
方法一:如果想将2.x版本(目前colab默认2.x)改成1.x (这种方式只能在1.x和2.x之间转换)
%tensorflow_version 1.x
import tensorflow as tf
tf.__version__
方法二:同本地命令行
!pip uninstall tensorflow
!pip install tensorflow==1.11
注意:上面两种方法使用完成后,都要重启runtime,命令如下:
import os
os.kill(os.getpid(), 9)
#out = cv2.VideoWriter(‘./output/‘+args["input"][43:57]+ "_" + args["class"] + ‘_output.avi‘, fourcc, 15, (w, h))
out = cv2.VideoWriter(‘./‘+args["input"][43:57]+ "_" + args["class"] + ‘_output.avi‘, fourcc, 15, (w, h))
Cannot connect to X server GOOGLE COLAB
简而言之:注释掉所有输出(如cv.imshow等),转为保存成文件
https://zhuanlan.zhihu.com/p/98210226
https://www.jianshu.com/p/a42d69568966
https://zhuanlan.zhihu.com/p/105647700
https://zhuanlan.zhihu.com/p/89311070?utm_source=wechat_session
原文:https://www.cnblogs.com/icodes8238/p/12636186.html