Python3:找不到"vcomp140.dll(或其依赖项之一)".在尝试导入nltk时 [英] Python3: Could not find "vcomp140.dll (or one of its dependencies)" while trying to import nltk

查看:467
本文介绍了Python3:找不到"vcomp140.dll(或其依赖项之一)".在尝试导入nltk时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试在Windows 10 Pro的Python 3.9.1上导入nltk时,出现以下错误:

When I try to import nltk on Python 3.9.1 on Windows 10 Pro, I get the following error:

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import nltk
  File "C:\Users\<USERNAME>\AppData\Local\Programs\Python\Python39\lib\site-packages\nltk\__init__.py", line 142, in <module>
    from nltk.chunk import *
  File "C:\Users\<USERNAME>\AppData\Local\Programs\Python\Python39\lib\site-packages\nltk\chunk\__init__.py", line 157, in <module>
    from nltk.chunk.api import ChunkParserI
  File "C:\Users\<USERNAME>\AppData\Local\Programs\Python\Python39\lib\site-packages\nltk\chunk\api.py", line 13, in <module>
    from nltk.parse import ParserI
  File "C:\Users\<USERNAME>\AppData\Local\Programs\Python\Python39\lib\site-packages\nltk\parse\__init__.py", line 100, in <module>
    from nltk.parse.transitionparser import TransitionParser
  File "C:\Users\<USERNAME>\AppData\Local\Programs\Python\Python39\lib\site-packages\nltk\parse\transitionparser.py", line 19, in <module>
    from sklearn.datasets import load_svmlight_file
  File "C:\Users\<USERNAME>\AppData\Local\Programs\Python\Python39\lib\site-packages\sklearn\__init__.py", line 80, in <module>
    from . import _distributor_init  # noqa: F401
  File "C:\Users\<USERNAME>\AppData\Local\Programs\Python\Python39\lib\site-packages\sklearn\_distributor_init.py", line 23, in <module>
    WinDLL(op.abspath(vcomp140_dll_filename))
  File "C:\Users\<USERNAME>\AppData\Local\Programs\Python\Python39\lib\ctypes\__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module 'C:\Users\<USERNAME>\AppData\Local\Programs\Python\Python39\lib\site-packages\sklearn\.libs\vcomp140.dll' (or one of its dependencies). Try using the full path with constructor syntax.

有什么办法解决这个问题吗?我尝试重新安装ntlk(通过键入 pip install nltk ),但是它不起作用.我也尝试过 pip install sklearn ,没有成功.即使先卸载nltk然后再重新安装也无济于事,这一切之后都没有重启计算机.

Any idea how to fix this? I've tried reinstalling ntlk (by typing pip install nltk), but it doesn't work. I've also tried pip install sklearn, no success. Even uninstalling nltk first and then reinstalling did not help, nor did restarting the computer after all this.

我还可以确定在 C:\ Users \中没有名为 .libs 的子文件夹(或文件)(对于此问题,也没有 libs ).< USERNAME> \ AppData \ Local \ Programs \ Python \ Python39 \ lib \ site-packages \ sklearn 文件夹.

I can also tell that there is no subfolder (or file) called .libs (nor libs for that matter) in the C:\Users\<USERNAME>\AppData\Local\Programs\Python\Python39\lib\site-packages\sklearn folder.

我也尝试过从答案中发布的链接安装Visual C ++,但是它说已经安装了,所以也不起作用.这是日志文件,再次将我的真实用户名替换为.

I've also tried to install Visual C++ from the link posted in an answer, but it does not work either as it says that it's already installed. Here's the log file, again my real username replaced with .

[25D4:3C14][2021-04-30T10:53:19]i001: Burn v3.7.3813.0, Windows v10.0 (Build 19041: Service Pack 0), path: C:\Users\<USERNAME>\Downloads\vc_redist.x64.exe, cmdline: ''
[25D4:3C14][2021-04-30T10:53:19]i000: Setting string variable 'WixBundleLog' to value 'C:\Users\<USERNAME>\AppData\Local\Temp\dd_vcredist_amd64_20210430105319.log'
[25D4:3C14][2021-04-30T10:53:19]i000: Setting string variable 'WixBundleOriginalSource' to value 'C:\Users\<USERNAME>\Downloads\vc_redist.x64.exe'
[25D4:3C14][2021-04-30T10:53:19]i000: Setting string variable 'WixBundleOriginalSourceFolder' to value 'C:\Users\<USERNAME>\Downloads\'
[25D4:3C14][2021-04-30T10:53:19]i000: Setting string variable 'WixBundleName' to value 'Microsoft Visual C++ 2015 Redistributable (x64) - 14.0.23026'
[25D4:3C14][2021-04-30T10:53:19]i100: Detect begin, 10 packages
[25D4:3C14][2021-04-30T10:53:19]i000: File search: windows_uCRT_DetectKey, did not find path: C:\windows\system32\api-ms-win-crt-runtime-l1-1-0.dll
[25D4:3C14][2021-04-30T10:53:19]i000: File search: windows_uCRT_DetectKeyExists, did not find path: C:\windows\system32\api-ms-win-crt-runtime-l1-1-0.dll
[25D4:3C14][2021-04-30T10:53:19]i000: Setting numeric variable 'windows_uCRT_DetectKeyExists' to value 0
[25D4:3C14][2021-04-30T10:53:19]i102: Detected related bundle: {282975d8-55fe-4991-bbbb-06a72581ce58}, type: Upgrade, scope: PerMachine, version: 14.24.28127.4, operation: Downgrade
[25D4:3C14][2021-04-30T10:53:19]i108: Detected compatible package: vcRuntimeMinimum_x64, provider: Microsoft.VS.VC_RuntimeMinimumVSU_amd64,v14, installed: {7DC387B8-E6A2-480C-8EF9-A6E51AE81C19}, version: 14.24.28127, chained: {0D3E9E15-DE7A-300B-96F1-B4AF12B96488}
[25D4:3C14][2021-04-30T10:53:19]i103: Detected related package: {7DC387B8-E6A2-480C-8EF9-A6E51AE81C19}, scope: PerMachine, version: 14.24.28127.0, language: 0 operation: Downgrade
[25D4:3C14][2021-04-30T10:53:19]i108: Detected compatible package: vcRuntimeAdditional_x64, provider: Microsoft.VS.VC_RuntimeAdditionalVSU_amd64,v14, installed: {8678BA04-D161-45BE-ACA4-CC5D13073F35}, version: 14.24.28127, chained: {BC958BD2-5DAC-3862-BB1A-C1BE0790438D}
[25D4:3C14][2021-04-30T10:53:19]i103: Detected related package: {8678BA04-D161-45BE-ACA4-CC5D13073F35}, scope: PerMachine, version: 14.24.28127.0, language: 0 operation: Downgrade
[25D4:3C14][2021-04-30T10:53:19]i052: Condition '(windows_uCRT_DetectKeyExists AND windows_uCRT_DetectKey >= v10.0.10137.0)' evaluates to false.
[25D4:3C14][2021-04-30T10:53:19]i052: Condition '(windows_uCRT_DetectKeyExists AND windows_uCRT_DetectKey >= v10.0.10137.0)' evaluates to false.
[25D4:3C14][2021-04-30T10:53:19]i052: Condition '(windows_uCRT_DetectKeyExists AND windows_uCRT_DetectKey >= v10.0.10137.0)' evaluates to false.
[25D4:3C14][2021-04-30T10:53:19]i052: Condition '(windows_uCRT_DetectKeyExists AND windows_uCRT_DetectKey >= v10.0.10137.0)' evaluates to false.
[25D4:3C14][2021-04-30T10:53:19]i052: Condition '(windows_uCRT_DetectKeyExists AND windows_uCRT_DetectKey >= v10.0.10137.0)' evaluates to false.
[25D4:3C14][2021-04-30T10:53:19]i052: Condition '(windows_uCRT_DetectKeyExists AND windows_uCRT_DetectKey >= v10.0.10137.0)' evaluates to false.
[25D4:3C14][2021-04-30T10:53:19]i052: Condition '(windows_uCRT_DetectKeyExists AND windows_uCRT_DetectKey >= v10.0.10137.0)' evaluates to false.
[25D4:3C14][2021-04-30T10:53:19]i052: Condition '(windows_uCRT_DetectKeyExists AND windows_uCRT_DetectKey >= v10.0.10137.0)' evaluates to false.
[25D4:3C14][2021-04-30T10:53:19]i101: Detected package: vcRuntimeMinimum_x64, state: Obsolete, cached: None
[25D4:3C14][2021-04-30T10:53:19]i101: Detected package: vcRuntimeAdditional_x64, state: Obsolete, cached: None
[25D4:3C14][2021-04-30T10:53:19]i101: Detected package: Windows81_x86, state: Absent, cached: None
[25D4:3C14][2021-04-30T10:53:19]i101: Detected package: Windows81_x64, state: Absent, cached: None
[25D4:3C14][2021-04-30T10:53:19]i101: Detected package: Windows8_x86, state: Absent, cached: None
[25D4:3C14][2021-04-30T10:53:19]i101: Detected package: Windows8_x64, state: Absent, cached: None
[25D4:3C14][2021-04-30T10:53:19]i101: Detected package: Windows7_MSU_x86, state: Absent, cached: None
[25D4:3C14][2021-04-30T10:53:19]i101: Detected package: Windows7_MSU_x64, state: Absent, cached: None
[25D4:3C14][2021-04-30T10:53:19]i101: Detected package: WindowsVista_MSU_x86, state: Absent, cached: None
[25D4:3C14][2021-04-30T10:53:19]i101: Detected package: WindowsVista_MSU_x64, state: Absent, cached: None
[25D4:3C14][2021-04-30T10:53:19]i052: Condition 'VersionNT64 >= v6.0 OR (VersionNT64 = v5.2 AND ServicePackLevel >= 1)' evaluates to true.
[25D4:3C14][2021-04-30T10:53:19]i199: Detect complete, result: 0x0
[25D4:2BC0][2021-04-30T10:53:22]e000: Error 0x80070666: Cannot install a product when a newer version is installed.

推荐答案

正如@Rabindra建议的那样,问题出在

As @Rabindra suggests, the issue lies in missing Visual Studio C++ Redistributable binaries.

您可以从官方链接.它们依赖于Windows上编译的许多公开Python API(或实际上与C ++库接口的python模块)的C ++库.

You can install them from the official link. They are dependency of many of the C++ libraries compiled on Windows that expose Python API (or python modules that are in fact interfacing into C++ libraries).

这篇关于Python3:找不到"vcomp140.dll(或其依赖项之一)".在尝试导入nltk时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆