温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》
  • 首页 > 
  • 教程 > 
  • 开发技术 > 
  • pycharm中导入模块错误时提示Try to run this command from the system terminal怎么办

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

发布时间:2021-06-22 15:56:21 来源:亿速云 阅读:9166 作者:小新 栏目:开发技术

这篇文章主要为大家展示了“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. 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中导入模块错误时提示Try to run this command from the system terminal怎么办”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注亿速云行业资讯频道!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI