pycharm中导入模块错误时,提示: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中导入keras时提示如题信息;上网查找资料,需要先添加keras库,步骤如下:pycharm菜单栏 File Settings…然后单击Project Project Interpreter 在里面Project Interpreter界面最右边有个加号,单击加号,然后在搜索框输入keras/tiffile/matplotlib,找到后单击左下方的Install Package即可。一般情况下这样是可以成功的,但是报错,提示信息大概意思是pip版本不对。原来默认下载地址(https://pypi.python.org/simple)。
发现通过这种方法导入的keras模块和自己之前安装的不是python中安装的,是重新安装的。比如我的电脑之前anaconda中安装的是2.1.1版本 ,而这种方法是安装的2.3.1版本的。是否pycharm工作路径和python工作路径不一样,则需要重新下载安装需要的模块?
参考该篇博客,在pycharm工作路径中下载安装需要的模块。
根据字面意思理解,一直以为是pip版本不对导致的,于是花费时间在更新pip版本上。根据导入模块时错误提示信息可以看出,我的pycharm路径为D:\u-net segmentation\venv\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
至此,花费半个下午的时间终于将需要的库安装成功。
总结
更新日志
- 孙悦.1996-伙伴【正大国际】【WAV+CUE】
- 纪钧瀚《钢琴阅读时光 雨中书店聆听轻音乐》[FLAC/分轨][399.62MB]
- 证声音乐图书馆《走向自然 疗心爵士乐》[320K/MP3][87.4MB]
- 证声音乐图书馆《走向自然 疗心爵士乐》[FLAC/分轨][184.94MB]
- 陈慧娴.2018-Priscilla-Ism演唱会3CD(2024环球红馆40复刻系列)【环球】【WAV+CUE】
- 郑秀文.1999-我应该得到(国)【华纳】【WAV+CUE】
- 陈家慧.2011-钢琴酒吧2CD【龙吟唱片】【WAV+CUE】
- 证声音乐图书馆《雨季 蓝调吉他 Rainy Blues》[320K/MP3][45.01MB]
- 证声音乐图书馆《雨季 蓝调吉他 Rainy Blues》[FLAC/分轨][109.13MB]
- 赞多《序章》[320K/MP3][45.54MB]
- 许巍.2004-每一刻都是崭新的【步升大风】【WAV+CUE】
- 群星.2024-四方馆影视原声带【韶愔音乐】【FLAC分轨】
- 陈雷.1997-安锁咧【金圆唱片】【WAV+CUE】
- 关淑怡.2013-MY.FAVORITE.SK.3CD【环球】【WAV+CUE】
- Sweety.2006-花言乔语【丰华】【WAV+CUE】