控制台:pip install tensorflow
發現自己安裝過,且版本2.4.1
搜索發現自己的python3.8版本無對應 tensorflow,故刪除3.8版本,下載3.7版本【百度有教程】。
對應python3.7版本的tensorflow我下載的是1.14.0。其他應該也可,官網有對應表。
但是速度慢,畢竟使用pip下載。故換鏡像下載:
修改為國內源:
新版ubuntu要求使用https源,要注意。
清華:https://pypi.tuna.tsinghua.edu.cn/simple
阿里雲:http://mirrors.aliyun.com/pypi/simple/
中國科技大學 https://pypi.mirrors.ustc.edu.cn/simple/
華中理工大學:http://pypi.hustunique.com/
山東理工大學:http://pypi.sdutlinux.org/
豆瓣:http://pypi.douban.com/simple/
臨時使用:
可以在使用pip的時候加參數 -i https://pypi.tuna.tsinghua.edu.cn/simple
例如:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow==1.14.0,這樣就會從清華這邊的鏡像去安裝tensorflow庫。
【注意!!!我看了csdn一個博主的:pip install tensorflow-gpu==1.14.0.好像是這個,反正tensorflow后面有gpu,把我搞慘了,因為我電腦根本沒有支持的gpu,只能用cpu的(pip install tensorflow就是用cpu)】