栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

Google colab踩坑

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Google colab踩坑

1.在使用的时候,先将数据传入Google Drive中,然后在Colab中连接Google Colab
from google.colab import drive
drive.mount('/content/drive')
2.进入到自己的文件夹下:

在colab中,直接这样做就可以

cd 想要进入的文件夹名字/
3.安装Anaconda来配置需要的安装包:
!wget -c https://repo.continuum.io/archive/Anaconda3-5.1.0-Linux-x86_64.sh
!chmod +x Anaconda3-5.1.0-Linux-x86_64.sh
!bash ./Anaconda3-5.1.0-Linux-x86_64.sh -b -f -p /usr/local
 
import sys
sys.path.append('/usr/local/lib/python3.6/site-packages/')
4.Linux下Anaconda的虚拟环境创建、激活

虚拟环境创建:

!conda create -n 虚拟环境名称 python=3.7

激活虚拟环境:

!source cnonda activate 虚拟环境

虚拟环境被激活之后,就不用进行其他的操作了,激活了虚拟环境后,想要运行的python文件就会在这个虚拟环境下运行

安装各种依赖库时常会出现的错误有三个:

(1)Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-nr4ydx_8/opencv-python/

!pip install --upgrade setuptools

(2)Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-ud_idlo6/opencv-python/

!python -m pip install --upgrade pip

(3)ERROR: Cannot uninstall 'PyYAML'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

pip install PyYAML --ignore-installed
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/998250.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号