Error reporting of importing tensorflow package from pycharm

 [ Note] pycharm imports the tensorflow package and reports an error

If you also encounter this problem, it means you don’t understand where tensorflow is

After installing Anaconda 3.6, set interpreter in pycharm. This interpreter determines how to execute the code you write in pycharm environment

If your setting is python.exe under anaconda. You will find that import tensorflow is written in pycharm   When as TF, an error will be reported, indicating that there is no tensorflow module. This is because python.exe in Anaconda file is version 3.6, and the CONDA environment you created is under anaconda, and the tensorflow you installed is in CONDA environment, not Anaconda environment. Therefore, if you want to import tensorflow, you need to select python.exe in CONDA environment as the interpreter

When your interpreter selects python.exe under Anaconda in the red box shown in the figure below, you will be prompted that the tensorflow module is not found when importing tensorflow in pycharm environment

 

If you want to use tensorflow, the interpreter should choose the following path (Anaconda – > envs-> tenfowflow-> Python.exe under python. Exe)

The correct selection of the interpreter is shown in the figure. Click the setting button indicated by the arrow in the figure below, select add local, and select python.exe of the path shown in the figure above instead of python.exe under anaconda. After selecting python.exe under CONDA environment, the settings shown in the red box in the figure below will be displayed

 

Similar Posts: