2024-09-27 04:29:20 发布
网友
我在centos7中使用sudopip install tensorflow-1.7.0rc0-cp27-cp27mu-manylinux1_x86_64.whl,python版本是2.7.14
pip install tensorflow-1.7.0rc0-cp27-cp27mu-manylinux1_x86_64.whl
2.7.14
我成功地安装了tensorflow,但是当我运行import tensorflow as tf时,我得到一个错误:没有模块名为tensorflow
import tensorflow as tf
我该怎么办?谢谢!在
正如评论中提到的,安装pyton包的最佳方法是使用虚拟环境。为了实现这一点,您可以使用以下命令为linux x86安装Minicaonda:
linux x86
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh bash ./Miniconda3-latest-Linux-x86_64.sh
然后值得阅读instructions on using conda,以建立一个名为tensorflow的虚拟环境。但基本命令应该是:
tensorflow
如果你想在python3.6中使用tensorflow。然后激活tensorflow conda环境:
你应该可以导入tensorflow而没有问题。在
(tensorflow) user@machine:~$ python Python 3.6.5 |Anaconda, Inc.| (default, Apr 29 2018, 16:14:56) [GCC 7.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import tensorflow as tf >>>
正如评论中提到的,安装pyton包的最佳方法是使用虚拟环境。为了实现这一点,您可以使用以下命令为
linux x86
安装Minicaonda:然后值得阅读instructions on using conda,以建立一个名为
^{pr2}$tensorflow
的虚拟环境。但基本命令应该是:如果你想在python3.6中使用tensorflow。然后激活tensorflow conda环境:
^{3}$你应该可以导入tensorflow而没有问题。在
相关问题 更多 >
编程相关推荐