I'm working on Windows 7 64bits with Anaconda 3. On my environment Nifti, I have installed Tensorflow 2.1.0, Keras 2.3.1 and Python 3.7.7.
On Visual Studio Code there is a problem with all of these imports:
from tensorflow.python.keras.models import Model
from tensorflow.keras.layers import Input, Dense, Conv2D, Conv2DTranspose, UpSampling2D, MaxPooling2D, Flatten, ZeroPadding2D
from tensorflow.keras.preprocessing.image import ImageDataGenerator
from tensorflow.keras.optimizers import Adam
I get these errors:
No name 'python' in module 'tensorflow'
Unable to import 'tensorflow.python.keras.models'
Unable to import 'tensorflow.keras.layers'
Unable to import 'tensorflow.keras.preprocessing.image'
Unable to import 'tensorflow.keras.optimizers'
Visual Studio Code is using the same anaconda environment: D:\Users\VansFannel\Programs\anaconda3\envs\nifti
. I have checked it on "Python: Select Interpreter command" option in Visual Studio.
If I do this on a CMD shell with nifti environment activate, python -c 'from tensorflow.python.keras.models import Model
, I don't get any error.
If I do with iPython:
from tensorflow.python.keras.models import Model
I don't get any error either.
I have checked python.pythonpath
settings, and it points to: D:\Users\VansFannel\Programs\anaconda3\envs\nifti
And in the bottom left corner I can see:
When I open a new Terminal on Visual Studio Code, I get these messages:
Microsoft Windows [Versión 6.1.7601] Copyright (c) 2009 Microsoft Corporation. Reservados todos los derechos. D:\Sources\Repos\University\TFM\PruebasPython\Nifty>D:/Usuarios/VansFannel/Programs/anaconda3/Scripts/activate (base) D:\Sources\Repos\University\TFM\PruebasPython\Nifty>conda activate nifti (nifti) D:\Sources\Repos\University\TFM\PruebasPython\Nifty>
If I run the code in Visual Studio Code with Ctrl. + F5
, it runs without any errors although it displays the errors on the Problems
tab.
With pyCharm, I don't get any errors.
How an I fix this problem?