无法在 PyCharm 中导入 tensorflow [英] Can't import tensorflow in PyCharm
问题描述
我正在尝试在 PyCharm 中导入 tensorflow,但是我收到一个错误,提示找不到该模块.我使用 pip install 来安装 tensorflow.此外,当我查看 PyCharm 中的解释器时,它说我有 pip 版本 9.0.1,最新版本是 10.0.1.我已经使用 pip 命令升级到 10.0.1,当我运行 pip --version 时,它说我得到了 10.0.1.我尝试过重新安装 pycharm 和制作新项目,但都没有运气.
I'm trying to import tensorflow in PyCharm, however I get an error that the module is not found. I used pip install to install tensorflow. Also when I look at the interpreter in PyCharm it says I have pip version 9.0.1 and the latest is 10.0.1. I have upgraded to 10.0.1 using the pip commands, and when I run pip --version it says I got 10.0.1. I have tried both reinstalling pycharm and making new projects with no luck.
推荐答案
转到文件 -> 设置 -> Project:projectname -> Project Interpreter
Go to Files -> Settings -> Project:projectname -> Project Interpreter
有可能为您的项目选择了与您安装 tensorflow 的解释器不同的解释器.如果您在 linux 上运行,您可以使用which pip"检查安装 tensorflow 的 Python 发行版的路径.
It's possible, that there is a different interpreter choosen for your project then the one you installed tensorflow in. If you're running on linux you can check with "which pip" the path to your python distro in which you installed tensorflow.
这篇关于无法在 PyCharm 中导入 tensorflow的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!