PyCharm: How to Solve Tensorflow_datasets Import Error

[error scenario]

(1) Pycharm version: pycharm 2021.2.2 (Community Edition)

(2)Python Interpret:Anaconda3(64-bit)

(3)Python 3.8.11

(4)tensorflow 2.3

When using RNN for text classification experiment, the following import statement at the beginning of the program makes an error:

import tensorflow_datasets as tfds

[solution]

Select the menu file -> Open the settings dialog box, expand the project: [current project name] item in the left panel, select the python interpret item, and select the “+” icon in the right panel to open the available packages dialog box. The settings dialog box is shown in the following figure:

Enter tensorflow datasets in the search bar at the top of the available packages dialog box. After the tensorflow datasets module name appears in the list below the search bar, select it, and then click the install package button at the bottom to wait for the installation to complete. [note] the middle line of the package name here is a middle line, not an underscore, but an underscore in the front and back import statements.

Read More: