溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

pycharm中導(dǎo)入模塊錯誤時提示Try to run this command from the system terminal怎么辦

發(fā)布時間:2021-06-22 15:56:21 來源:億速云 閱讀:9268 作者:小新 欄目:開發(fā)技術(shù)

這篇文章主要為大家展示了“pycharm中導(dǎo)入模塊錯誤時提示Try to run this command from the system terminal怎么辦”,內(nèi)容簡而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓小編帶領(lǐng)大家一起研究并學(xué)習(xí)一下“pycharm中導(dǎo)入模塊錯誤時提示Try to run this command from the system terminal怎么辦”這篇文章吧。

pycharm中導(dǎo)入模塊錯誤時,提示:Try to run this command from the system terminal. Make sure that you use the correct version of ‘pip' installed for your Python interpreter located atpycharm工作路徑。

安裝好pycharm,而且Python中安裝了keras,在pycharm中導(dǎo)入keras時提示如題信息;上網(wǎng)查找資料,需要先添加keras庫,步驟如下:pycharm菜單欄 File >> Settings…然后單擊Project >> Project Interpreter >> 在里面Project Interpreter界面最右邊有個加號,單擊加號,然后在搜索框輸入keras/tiffile/matplotlib,找到后單擊左下方的Install Package即可。一般情況下這樣是可以成功的,但是報錯,提示信息大概意思是pip版本不對。原來默認下載地址(https://pypi.python.org/simple)。

發(fā)現(xiàn)通過這種方法導(dǎo)入的keras模塊和自己之前安裝的不是python中安裝的,是重新安裝的。比如我的電腦之前anaconda中安裝的是2.1.1版本 ,而這種方法是安裝的2.3.1版本的。是否pycharm工作路徑和python工作路徑不一樣,則需要重新下載安裝需要的模塊?

pycharm中導(dǎo)入模塊錯誤時提示Try to run this command from the system terminal怎么辦
pycharm中導(dǎo)入模塊錯誤時提示Try to run this command from the system terminal怎么辦
————————————————
pycharm中導(dǎo)入模塊錯誤時提示Try to run this command from the system terminal怎么辦

pycharm中導(dǎo)入模塊錯誤時提示Try to run this command from the system terminal怎么辦

pycharm中導(dǎo)入模塊錯誤時提示Try to run this command from the system terminal怎么辦

pycharm中導(dǎo)入模塊錯誤時提示Try to run this command from the system terminal怎么辦

參考該篇博客,在pycharm工作路徑中下載安裝需要的模塊。

pycharm中導(dǎo)入模塊錯誤時提示Try to run this command from the system terminal怎么辦

pycharm中導(dǎo)入模塊錯誤時提示Try to run this command from the system terminal怎么辦

根據(jù)字面意思理解,一直以為是pip版本不對導(dǎo)致的,于是花費時間在更新pip版本上。根據(jù)導(dǎo)入模塊時錯誤提示信息可以看出,我的pycharm路徑為D:\u-net segmentation\venv\Scripts。在該徑路下打開命令窗口,輸入python.exe -m pip install matplotlib -i http://pypi.douban.com/simple --trusted-host pypi.douban.com。(豆瓣國內(nèi)源)??梢钥闯?,輸入完畢后,之前只有numpy、pip以及setuptools三個庫,現(xiàn)在多出6個包。一定要在錯誤中提示的路徑下安裝導(dǎo)入所需模塊。如法炮制,把紅色的matplotlib替換成你要安裝的庫就可以了。

python.exe -m pip install keras -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
python.exe -m pip install tiffile -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
python.exe -m pip install tensorflow -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

至此,花費半個下午的時間終于將需要的庫安裝成功。

以上是“pycharm中導(dǎo)入模塊錯誤時提示Try to run this command from the system terminal怎么辦”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對大家有所幫助,如果還想學(xué)習(xí)更多知識,歡迎關(guān)注億速云行業(yè)資訊頻道!

向AI問一下細節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI