[Tutor] Not able to import Tensorflow in python script

Alan Gauld alan.gauld at yahoo.co.uk
Wed Oct 25 16:27:39 EDT 2017


On 25/10/17 19:24, shubham goyal wrote:
> I was trying to run this check script of tensorflow after installing the
> tensorflow successfully.

Its not part of the standard library so I'll need to assume you
are correct and it installed correctly. However from some of the
errors below it looks as if you \also need numpy/SciPy installed
 - have you done that too?

If so then I hope somebody else can assist.

You might find a tensorflow help forum or email address you
can ask too?


> "/home/goyal/tensorflow/lib/python3.5/site-packages/tensorflow/python/__init__.py",
> line 47, in <module>
>     import numpy as np
>   File
> "/home/goyal/tensorflow/lib/python3.5/site-packages/numpy/__init__.py",
> line 142, in <module>
>     from . import add_newdocs
>   File
> "/home/goyal/tensorflow/lib/python3.5/site-packages/numpy/add_newdocs.py",
> line 13, in <module>
>     from numpy.lib import add_newdoc
>   File
> "/home/goyal/tensorflow/lib/python3.5/site-packages/numpy/lib/__init__.py",
> line 8, in <module>
>     from .type_check import *
>   File
> "/home/goyal/tensorflow/lib/python3.5/site-packages/numpy/lib/type_check.py",
> line 11, in <module>
>     import numpy.core.numeric as _nx
>   File
> "/home/goyal/tensorflow/lib/python3.5/site-packages/numpy/core/__init__.py",
> line 74, in <module>
>     from numpy.testing.nosetester import _numpy_tester
>   File
> "/home/goyal/tensorflow/lib/python3.5/site-packages/numpy/testing/__init__.py",
> line 10, in <module>
>     from unittest import TestCase
>   File "/usr/lib/python3.5/unittest/__init__.py", line 59, in <module>
>     from .case import (TestCase, FunctionTestCase, SkipTest, skip, skipIf,
>   File "/usr/lib/python3.5/unittest/case.py", line 6, in <module>
>     import logging
>   File "/usr/lib/python3.5/logging/__init__.py", line 28, in <module>
>     from string import Template
> ImportError: cannot import name 'Template'

Do you have the right version of numpy for your module?


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list