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使用mailbox打印电子邮件的方法
Apr 30 Python
python 实现红包随机生成算法的简单实例
Jan 04 Python
浅谈python配置与使用OpenCV踩的一些坑
Apr 02 Python
Pandas Shift函数的基础入门学习笔记
Nov 16 Python
详解python中list的使用
Mar 15 Python
使用Python创建简单的HTTP服务器的方法步骤
Apr 26 Python
对pyqt5中QTabWidget的相关操作详解
Jun 21 Python
Pytorch实现GoogLeNet的方法
Aug 18 Python
Python协程操作之gevent(yield阻塞,greenlet),协程实现多任务(有规律的交替协作执行)用法详解
Oct 14 Python
Python有参函数使用代码实例
Jan 06 Python
django 多数据库及分库实现方式
Apr 01 Python
pytorch中的weight-initilzation用法
Jun 24 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
关于PHP的相似度计算函数:levenshtein的使用介绍
2013/04/15 PHP
基于Laravel-admin 后台的自定义页面用法详解
2019/09/30 PHP
用javascript实现兼容IE7的类库 IE7_0_9.zip提供下载
2007/08/08 Javascript
使用 JScript 创建 .exe 或 .dll 文件的方法
2011/07/13 Javascript
iframe 上下滚动条如何默认在下方实现原理
2012/12/10 Javascript
jquery+ajax实现注册实时验证实例详解
2015/12/08 Javascript
进阶之初探nodeJS
2017/01/24 NodeJs
JavaScript 中调用 Kotlin 方法实例详解
2017/06/09 Javascript
JavaScript中使用import 和require打包后实现原理分析
2018/03/07 Javascript
原生JS实现$.param() 函数的方法
2018/08/10 Javascript
微信小程序如何修改本地缓存key中单个数据的详解
2019/04/26 Javascript
通过js示例讲解时间复杂度与空间复杂度
2019/08/06 Javascript
在JavaScript中实现链式调用的实现
2019/12/24 Javascript
Javascript ParentNode和ChildNode接口原理解析
2020/03/16 Javascript
node.js 如何监视文件变化
2020/09/01 Javascript
利用js canvas实现五子棋游戏
2020/10/11 Javascript
python获取网页状态码示例
2014/03/30 Python
利用Python的Twisted框架实现webshell密码扫描器的教程
2015/04/16 Python
Python获取当前公网ip并自动断开宽带连接实例代码
2018/01/12 Python
Python画柱状统计图操作示例【基于matplotlib库】
2018/07/04 Python
Pycharm代码无法复制,无法选中删除,无法编辑的解决方法
2018/10/22 Python
python twilio模块实现发送手机短信功能
2019/08/02 Python
python双向链表原理与实现方法详解
2019/12/03 Python
CSS3 实现时间轴动画
2020/11/25 HTML / CSS
物理学专业自荐信
2014/06/11 职场文书
效能风暴心得体会
2014/09/04 职场文书
2014年教师教学工作总结
2014/11/08 职场文书
三行辞职书范文
2015/02/26 职场文书
2015年国庆节广播稿
2015/08/19 职场文书
干货:如何写好工作计划!
2019/05/17 职场文书
公文写作:新员工转正申请书范本3篇!
2019/08/07 职场文书
导游词之西安骊山
2019/12/20 职场文书
python 如何在 Matplotlib 中绘制垂直线
2021/04/02 Python
MySQL8.0无法启动3534的解决方法
2021/06/03 MySQL
pandas求平均数和中位数的方法实例
2021/08/04 Python
JS前端canvas交互实现拖拽旋转及缩放示例
2022/08/05 Javascript