首页 > 其他分享 >Could not find the DLL(s) 'msvcp140_1.dll'. TensorFlow requires that these DLLs be install

Could not find the DLL(s) 'msvcp140_1.dll'. TensorFlow requires that these DLLs be install

时间:2023-05-31 11:45:35浏览次数:54  
标签:transformers Anaconda3 these Eprogramfiles Could dll File import line

 

 python -c "from transformers import pipeline; print(pipeline('sentiment-analysis')('we love you'))"
Microsoft Visual C++ Redistributable is not installed, this may lead to the DLL load failure.
                 It can be downloaded at https://aka.ms/vs/16/release/vc_redist.x64.exe
Traceback (most recent call last):
  File "E:\Eprogramfiles\Anaconda3\lib\site-packages\transformers\utils\import_utils.py", line 1172, in _get_module
    return importlib.import_module("." + module_name, self.__name__)
  File "E:\Eprogramfiles\Anaconda3\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "E:\Eprogramfiles\Anaconda3\lib\site-packages\transformers\pipelines\__init__.py", line 44, in <module>     
    from .audio_classification import AudioClassificationPipeline
  File "E:\Eprogramfiles\Anaconda3\lib\site-packages\transformers\pipelines\audio_classification.py", line 21, in <
module>
    from .base import PIPELINE_INIT_ARGS, Pipeline
  File "E:\Eprogramfiles\Anaconda3\lib\site-packages\transformers\pipelines\base.py", line 36, in <module>
    from ..modelcard import ModelCard
  File "E:\Eprogramfiles\Anaconda3\lib\site-packages\transformers\modelcard.py", line 48, in <module>
    from .training_args import ParallelMode
  File "E:\Eprogramfiles\Anaconda3\lib\site-packages\transformers\training_args.py", line 30, in <module>
    from .trainer_utils import (
  File "E:\Eprogramfiles\Anaconda3\lib\site-packages\transformers\trainer_utils.py", line 47, in <module>
    import tensorflow as tf
  File "E:\Eprogramfiles\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 41, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "E:\Eprogramfiles\Anaconda3\lib\site-packages\tensorflow\python\__init__.py", line 40, in <module>
    from tensorflow.python.eager import context
  File "E:\Eprogramfiles\Anaconda3\lib\site-packages\tensorflow\python\eager\context.py", line 35, in <module>     
    from tensorflow.python import pywrap_tfe
  File "E:\Eprogramfiles\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tfe.py", line 28, in <module>        
    from tensorflow.python import pywrap_tensorflow
  File "E:\Eprogramfiles\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 28, in <module>
    self_check.preload_check()
  File "E:\Eprogramfiles\Anaconda3\lib\site-packages\tensorflow\python\platform\self_check.py", line 54, in preload
_check
    raise ImportError(
ImportError: Could not find the DLL(s) 'msvcp140_1.dll'. TensorFlow requires that these DLLs be installed in a dire
ctory that is named in your %PATH% environment variable. You may install these DLLs by downloading "Microsoft C++ R
edistributable for Visual Studio 2015, 2017 and 2019" for your platform from this URL: https://support.microsoft.co
m/help/2977003/the-latest-supported-visual-c-downloads

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "<frozen importlib._bootstrap>", line 1039, in _handle_fromlist
  File "E:\Eprogramfiles\Anaconda3\lib\site-packages\transformers\utils\import_utils.py", line 1162, in __getattr__
    module = self._get_module(self._class_to_module[name])
  File "E:\Eprogramfiles\Anaconda3\lib\site-packages\transformers\utils\import_utils.py", line 1174, in _get_module
    raise RuntimeError(
RuntimeError: Failed to import transformers.pipelines because of the following error (look up to see its traceback)
:
Could not find the DLL(s) 'msvcp140_1.dll'. TensorFlow requires that these DLLs be installed in a directory that is  named in your %PATH% environment variable. You may install these DLLs by downloading "Microsoft C++ Redistributable for Visual Studio 2015, 2017 and 2019" for your platform from this URL: https://support.microsoft.com/help/2977003/the-latest-supported-visual-c-downloads
PS E:\Eprogramfiles\Anaconda3\Scripts>

解决方法:把 msvcp140_1.dll 复制到path变量中某一个文件夹即可。

 

 

 

 

 

 

 

 

 

==========================================

如何安装transformers

如何安装transformer  transformer  

1. 首先,需要安装Python。建议安装3.6及以上版本的Python。

2. 按照transformers官方文档的要求,需要额外安装PyTorch或TensorFlow。具体选择哪一个取决于您的需求。建议先安装PyTorch或TensorFlow,然后再安装transformers。

3. 打开终端,输入以下命令安装transformers:


   pip install transformers

4. 安装完成后,您可以尝试运行以下命令测试是否成功安装:


   python -c "from transformers import pipeline; print(pipeline('sentiment-analysis')('we love you'))"

   如果输出结果为:


   [{'label': 'POSITIVE', 'score': 0.9998704795837402}]

   则说明已经成功安装并使用transformers进行了情感分析。

 

REF

https://www.5axxw.com/questions/simple/1lzxjc

 

标签:transformers,Anaconda3,these,Eprogramfiles,Could,dll,File,import,line
From: https://www.cnblogs.com/emanlee/p/17442056.html

相关文章

  • .net调用动态库NationECCode.dll使用电子凭证二维码解码接口
    .net调用动态库NationECCode.dll使用电子凭证二维码解码接口 C#.net调用示例代码:[DllImport("NationECCode.dll",CallingConvention=CallingConvention.StdCall)]publicstaticexternvoidNationEcTrans(stringurl,stringinput,IntPtroutput);......
  • canal+rabbitmq: Could not convert incoming message with content-type [null]
    SpringBoot整合Canal+RabbitMQ实现监听MySQL数据库同步更新Redis缓存,编写RabbitMQ消费端监听同步缓存。接收消息是字符串返回的是字节数据,eg:-30,-128,-100,-25,-126,-71,-27,-81,-71,-25,-126,-71,-30,-128,-99使用了jackson的converter后,报了如下的异常:Causedby:......
  • opencv 无法使用 dll 动态链接库 UnsatisfiedLinkError java.library.path Can‘t fin
    System.loadLibrary(Core.NATIVE_LIBRARY_NAME)使用如上方法加载本地dll文件。 一般会出现两种错误:1、UnsatisfiedLinkErrorjava.library.path  2、UnsatisfiedLinkError Can'tfinddependentlibraries 第一种错误为没有加载到指定的dll文件,该配置可以百度搜索java.li......
  • 错误解决:These dependencies were not found: core-js/modules/es.array.push.js
    错误描述执行npmrundev后报错:Thesedependencieswerenotfound:core-js/modules/es.array.push.jsin./node_modules/@babel/runtime/helpers/objectSpread2.js,./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-pluvue?vue&type=script&la......
  • Unity的IPostBuildPlayerScriptDLLs:深入解析与实用案例
    UnityIPostBuildPlayerScriptDLLsUnityIPostBuildPlayerScriptDLLs是Unity引擎中的一个非常有用的功能,它可以让开发者在构建项目后自定义哪些文件需要被复制到输出目录中。这个功能可以帮助开发者更好地控制项目的构建过程,确保输出目录只包含必要的DLL文件。在本文中,我们将介绍U......
  • Unity的IPostBuildPlayerScriptDLLs:深入解析与实用案例
    UnityIPostBuildPlayerScriptDLLsUnityIPostBuildPlayerScriptDLLs是Unity引擎中的一个非常有用的功能,它可以让开发者在构建项目后自定义哪些文件需要被复制到输出目录中。这个功能可以帮助开发者更好地控制项目的构建过程,确保输出目录只包含必要的DLL文件。在本文中,我们将介绍......
  • 部分dll文件缺失解决方案
    1."vcruntime140_1.dll"缺失错误下载安装VisualC++RedistributableforVisualStudio2019即可!下载链接(点击即下载安装exe文件,勿随便点击)2.win10出现丢失“MSVCR100.dll”怎么解决下载安装VisualC++RedistributableforVisualStudio2010即可!下载链接(点击即下载安装ex......
  • Could not commit Hibernate transaction,Transaction not successfully started
    CouldnotcommitHibernatetransaction,Transactionnotsuccessfullystarted1.数据库操作和业务分离。事务内属于业务验证抛出的异常问题或其他不符合当前业务规则的异常,挪到上一层级,如接口层或业务视图层,以此避免该类问题2.evict。获取当前session,evict当前数据库对象,避......
  • WIN10 由于找不到mfc140u.dll,无法继续执行代码
    最近遇到win10提示mfc140u.dll找不到,总是弹窗的问题.网上一番百度搜索后发现给的方法都不能很好的解决,DLL修复工具需登录且收费去下载mfc140u.dll根本不可能找到,都是垃圾病毒,危险⚠️经过google搜索后找到比较科学的方法:`thefileMFC140.DLLispartdtheVisualC++Redistr......
  • 32. Longest Valid Parentheses刷题笔记
    用stack和dp来做classSolution:deflongestValidParentheses(self,s:str)->int:dp,stack=[0]*(len(s)+1),[]foriinrange(len(s)):ifs[i]=='(':stack.append(i)else:......