1. 程式人生 > 其它 >pycharm中匯入模組錯誤時提示Try to run this command from the system terminal. Make sure that you use the...

pycharm中匯入模組錯誤時提示Try to run this command from the system terminal. Make sure that you use the...

根據字面意思理解,一直以為是pip版本不對導致的,於是花費時間在更新pip版本上。
根據匯入模組時錯誤提示資訊可以看出,我的pycharm路徑為C:\Users\Administrator.USER-20190620KX\PycharmProjects\untitled20\Scripts。在該徑路下開啟命令視窗,輸入python.exe -m pip install matplotlib -i http://pypi.douban.com/simple --trusted-host pypi.douban.com。(豆瓣國內源)。可以看出,輸入完畢後,之前只有numpy、pip以及setuptools三個庫,現在多出6個包。一定要在錯誤中提示的路徑下安裝匯入所需模組。
如法炮製,把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 至此,花費半個下午的時間終於將需要的庫安裝成功。