I have installed tensorboardX, but I still get the error No module named 'tensorboardX'? ?

question:

pip install tensorboardX1. I have used the command to install the tensorboardX package in the jupyter notebook web version , but an error still occurs when running the program: No module named 'tensorboardX'
2. Or the same problem occurs when running jupyter notebook in VScode

solution:

1. First, you need to check your running environment. Take running jupyter notebook in VScode as an example. First check the running environment. You can see the kernel running python, as shown below: I have three environments, base, d2l, d2l-zh
Insert image description here
. Generally speaking, the basic ones installed are base. The last two are the environment names I created myself. At the same time, if you have not activated other running environments in cmd or anaconda prompt, they will also be base at the beginning. At the same time, which one do you want to use? To install the module package in the environment, you can use activate basethis command to activate it, and then use pip install tensorboardXthe command to install it in the environment.

2. The reason for the above problem is that you are running in the base environment (I am in this environment in VScode), and then your installation module package is not installed in this environment (actually I installed it in the d2l environment). ), just activate the corresponding environment and reinstall it!

activate base
pip install tensorboardX
result:

After installation, the program runs successfully!

[Long Yi’s Programming Life] Walk with you all the way!

Guess you like

Origin blog.csdn.net/weixin_43658159/article/details/117355078