[Python environment configuration error] Problems installing tensorflow ImportError: DLL load failed: The specified module could not be found

Newly opened NLP learning, Mofan's tutorial needs to use tensorflow 2.3.1, I have been doing research with 1.x before. So I re-created a new environment, encountered many problems, and finally solved them one by one.

  1. Install tensorflow directly with pip in the 3.7 environment. The result is ImportError: DLL load failed: The specified module cannot be found. This problem should be that the version of tensorflow does not correspond to other packages. After reinstalling several times, I found that it could not be solved, so I decided Uninstall and install with conda.
  2. Conda does not have version 2.3.1, so install 2.3.0 using
    conda install tensorflow-gpu=2.3.0 cudnn cudatoolkit is
    installed successfully, use
    import tensorflow as tf
    tf.test.is_gpu_available() on the command line to check if the GPU is available
    ** here It should be noted that because I need to install different versions of tf in different virtual environments, I cannot download cuda and cudnn like other online tutorials. That is for system installation. In the virtual environment, you should install the two installation packages of cuda and cudatoolkit directly. That's it.
  3. Running the program found that matplotlib was missing, so I installed it with conda, and the result appeared
    ERROR conda.core.link:_execute(700): An error occurred while installing package'defaults::qt-5.9.7-vc14h73c81de_0'.
    Rolling back transaction: done
    LinkError: post-link script failed for package defaults::qt-5.9.7-vc14h73c81de_0
    This should mean that the download source of conda is not right, so delete the Tsinghua source in C:\Users\Lenovo.condarc only Using the default source, the result is still the same error, so I switched to pip installation, and it was successful

Summary: I feel that pip and conda need to be replaced flexibly according to the problems that arise. An installation method may not be able to keep error-free. The main reason is that I don’t know much about these packages and conda, so I can only keep trying.

Guess you like

Origin blog.csdn.net/qq_45347185/article/details/112549469