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


Posted in Python onMarch 26, 2020

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导入模块错误内容请搜索三水点靠木以前的文章或继续浏览下面的相关文章希望大家以后多多支持三水点靠木!

Python 相关文章推荐
Python中用Ctrl+C终止多线程程序的问题解决
Mar 30 Python
Python爬虫框架Scrapy安装使用步骤
Apr 01 Python
Python base64编码解码实例
Jun 21 Python
Python hashlib模块用法实例分析
Jun 12 Python
python使用response.read()接收json数据的实例
Dec 19 Python
python实现人机猜拳小游戏
Feb 03 Python
pytorch对梯度进行可视化进行梯度检查教程
Feb 04 Python
Python中的xlrd模块使用原理解析
May 21 Python
Django实现前台上传并显示图片功能
May 29 Python
python 常用日期处理-- datetime 模块的使用
Sep 02 Python
python和C++共享内存传输图像的示例
Oct 27 Python
python生成随机数、随机字符、随机字符串
Apr 06 Python
Python多进程编程常用方法解析
Mar 26 #Python
简单了解python调用其他脚本方法实例
Mar 26 #Python
Python tornado上传文件的功能
Mar 26 #Python
Python Tornado批量上传图片并显示功能
Mar 26 #Python
python列表删除和多重循环退出原理详解
Mar 26 #Python
执行Python程序时模块报错问题
Mar 26 #Python
python3 正则表达式基础廖雪峰
Mar 25 #Python
You might like
地摊中国 - 珍藏老照片
2020/08/18 杂记
php 分页类 扩展代码
2009/06/11 PHP
php实现用手机关闭计算机(电脑)的方法
2015/04/22 PHP
WordPress的文章自动添加关键词及关键词的SEO优化
2016/03/01 PHP
对laravel in 查询的使用方法详解
2019/10/09 PHP
jQuery使用手册之三 CSS操作
2007/03/24 Javascript
childNodes.length与children.length的区别
2009/05/14 Javascript
解析Javascript中难以理解的11个问题
2013/12/09 Javascript
Js判断CSS文件加载完毕的具体实现
2014/01/17 Javascript
JavaScript在for循环中绑定事件解决事件参数不同的情况
2014/01/20 Javascript
javascript实现简单的鼠标拖动效果实例
2015/04/10 Javascript
封装属于自己的JS组件
2016/01/27 Javascript
详解JavaScript的AngularJS框架中的作用域与数据绑定
2016/03/04 Javascript
js操作数据库实现注册和登陆的简单实例
2016/05/26 Javascript
BootStrap中的表单大全
2016/09/07 Javascript
浅谈Angularjs link和compile的使用区别
2016/10/21 Javascript
vue.js 获取select中的value实例
2018/03/01 Javascript
微信小程序自定义可滑动日历界面
2018/12/28 Javascript
js实现拖拽与碰撞检测
2020/09/18 Javascript
[02:02:38]VG vs Mineski Supermajor 败者组 BO3 第一场 6.6
2018/06/07 DOTA
Python 类的继承实例详解
2017/03/25 Python
解决python执行不输出系统命令弹框的问题
2019/06/24 Python
Python json模块与jsonpath模块区别详解
2020/03/05 Python
Pycharm IDE的安装和使用教程详解
2020/04/30 Python
pip 20.3 新版本发布!即将抛弃 Python 2.x(推荐)
2020/12/16 Python
深入理解css属性的选择对动画性能的影响
2016/04/20 HTML / CSS
波比布朗英国官网:Bobbi Brown英国
2017/11/13 全球购物
SKECHERS官方旗舰店:美国舒适运动休闲品牌
2017/12/22 全球购物
就业自荐书
2013/12/05 职场文书
优秀教师的感人事迹
2014/02/04 职场文书
《跨越海峡的生命桥》教学反思
2014/02/24 职场文书
超市仓管员岗位职责范本
2014/09/18 职场文书
三方合作意向书范本
2015/05/09 职场文书
中国汉字听写大会观后感
2015/06/02 职场文书
深入探讨opencv图像矫正算法实战
2021/05/21 Python