The tyranny of Python tensorflow: xxxxxx ' Module ' object has no attribute ' xxxxx ' __python

Source: Internet
Author: User

If I can help you, I'll give you some praise.

Powered by Liu Yarong-standing on the shoulders of giants

All kinds of the tyranny Python tensorflow: xxxxxx ' Module ' object has no attribute ' xxxxx '

This example is: TensorFlow, ' module ' object has no attribute ' placeholder '

My environment:

Win10x64

Anaconda 1.5

Python3.6

tensorflow1.2.1

tensorflow-gpu1.1.0 (broken computer graphics card gt610m, as if not run up Tf-gpu, just use Anaconda uninstall this package)

Problem Description:

Open command terminal, enter Python, enter Python

Enter import TensorFlow as TF

Enter A = Tf.placeholder ("float", [None, A])

Error at this time: TensorFlow, ' module ' object has no attribute ' placeholder '

Or

In the Pycharm debugging times Wrong TensorFlow, ' module ' object has no attribute ' placeholder '

Solution idea:

There are several situations that cause such problems, and I will explain to you a few of the things I know.

1, may be your project folder or the path of a named TensorFlow file or folder, and TensorFlow This module name has a conflict, system calls may call the file or folder, rather than the tensorflow you want the module. You can change that file or folder by individual name.

2, the problem is just unloaded tensorflow-gpu this place. Train of thought: first TF and TF-GPU are all good when loaded, and use the GPU to run TensorFlow, the statement used is importtensorflow as TF. After unloading the TF-GPU, it may be a problem with this tensorflow path. I also do not bother to find any path, the direct use of Anaconda to TensorFlow also uninstall, and then use anaconda Reinstall TensorFlow (Anyway, I use the CPU to run the program, the GPU is too broken) on all OK.

attached:

Module search order in Python:

1, the directory containing the input script (or the current directory without the specified file)

2, Pythonpath (a list of directory names, like the variable path syntax in the shell)

3, the default path when installing the dependency package

If I can help you, I'll give you some praise.

Powered by Liu Yarong-standing on the shoulders of giants

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.