目錄
一、RuntimeError: module compiled against API version 0xc but this version of numpy is 0xb
二、AttributeError: module ‘tensorflow’ has no attribute ‘flags’
三、conda 更新 Please update conda by running
四、to search for alternate channels that may provide the conda package you're looking for, navigate to
五、RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is Fal
一、RuntimeError: module compiled against API version 0xc but this version of numpy is 0xb
問題:import?torch時報錯:RuntimeError: module compiled against API version 0xc but this version of numpy is 0xb
原因:這是numpy版本與python版本不匹配的問題
解決:
- 卸載原來版本的numpy
-
下載相匹配的numpy版本
在https://www.lfd.uci.edu/~gohlke/pythonlibs/找到對應版本的numpy,然后下載到本地 - 安裝
?
二、AttributeError: module ‘tensorflow’ has no attribute ‘flags’
問題:在我的code中是由該命令FLAGS = tf.flags.FLAGS引起的報錯,主要原因是我下載的tensorflow是最新的版本2.1,將tensorflow修改為1.9版本即可。
解決:
(2)第二種方法,在tensorflow官方在線文檔搜索tf.flags,通過觀看下圖可以看出flags模塊已經(jīng)移至compat.v1中,原命令修改為FLAGS = tf.compat.v1.flags.FLAGS即可。
三、conda 更新 Please update conda by running
問題:安裝numpy第三方庫的時候,輸入后發(fā)現(xiàn)有個提示:有最新conda版本下載
conda update -n base -c defaults conda
然后,我運行命令去更新conda,但是報錯了:EnvironmentNotWritableError: The current user does not have write permissions to the target environment.
原因:conda裝在虛擬機的C盤里沒有權(quán)限寫入,
解決:退出pycharm后,以管理員身份重新打開pycharm,再次輸入命令進行更新conda。
發(fā)現(xiàn),更新成功了。
四、to search for alternate channels that may provide the conda package you're looking for, navigate to
問題:安裝某個python包時(并不特別對于某個特定包,各種包有時都會出現(xiàn)這種情況 。會出現(xiàn)當前channel不可用,并報錯,
原因:其實很簡單,就是告訴你在這個指令的默認下載channel列表中找不到合適的安裝包,它是建議你去anaconda官網(wǎng)里面去找與之匹配的安裝包自己下載。
解決:
(1)你需要去 https://anaconda.org 這個網(wǎng)址,在上方的搜索條上搜索你要安裝這個包的其他channel,下邊展示一下如何找igraph的其他channel。
首先進入上述網(wǎng)址,你可以在上方看到搜索條,搜索numpy,會出現(xiàn)所有包名中包含“numpy”字段的包:
(2)接著在你的命令行窗口或Anaconda Prompt窗口對應的路徑下運行頁面中提供的任意一條命令即可。
(3)
五、RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is Fal
報錯:
RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use torch.load with map_location=torch.device('cpu') to map your storages to the CPU.
文章來源:http://www.zghlxwxcb.cn/news/detail-646579.html
解決方法:在加載模型的時候加上map_location=‘cpu’文章來源地址http://www.zghlxwxcb.cn/news/detail-646579.html
到了這里,關于【python 深度學習】解決遇到的問題的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網(wǎng)!