南强小屋 Design By 杰米

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中导入模块错误时提示Try to run this command from the system terminal
pycharm中导入模块错误时提示Try to run this command from the system terminal
————————————————
pycharm中导入模块错误时提示Try to run this command from the system terminal

pycharm中导入模块错误时提示Try to run this command from the system terminal

pycharm中导入模块错误时提示Try to run this command from the system terminal

pycharm中导入模块错误时提示Try to run this command from the system terminal

参考该篇博客,在pycharm工作路径中下载安装需要的模块。

pycharm中导入模块错误时提示Try to run this command from the system terminal

pycharm中导入模块错误时提示Try to run this command from the system terminal

根据字面意思理解,一直以为是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

至此,花费半个下午的时间终于将需要的库安装成功。

总结

标签:
pycharm导入模块错误,pycharm导入模块

南强小屋 Design By 杰米
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
南强小屋 Design By 杰米

评论“pycharm中导入模块错误时提示Try to run this command from the system terminal”

暂无pycharm中导入模块错误时提示Try to run this command from the system terminal的评论...

P70系列延期,华为新旗舰将在下月发布

3月20日消息,近期博主@数码闲聊站 透露,原定三月份发布的华为新旗舰P70系列延期发布,预计4月份上市。

而博主@定焦数码 爆料,华为的P70系列在定位上已经超过了Mate60,成为了重要的旗舰系列之一。它肩负着重返影像领域顶尖的使命。那么这次P70会带来哪些令人惊艳的创新呢?

根据目前爆料的消息来看,华为P70系列将推出三个版本,其中P70和P70 Pro采用了三角形的摄像头模组设计,而P70 Art则采用了与上一代P60 Art相似的不规则形状设计。这样的外观是否好看见仁见智,但辨识度绝对拉满。