gpt4 book ai didi

python - 如何让 Sublime Text 在使用命令行加载文件的地方加载 DLL

转载 作者:行者123 更新时间:2023-12-05 07:23:04 24 4
gpt4 key购买 nike

当通过命令行使用 python 时,我可以很好地导入模块。但是,当我在 SublimeText3 中构建 python 脚本时,某些模块不会导入。我通常会收到以下错误:

ImportError: DLL load failed: The specified module could not be found.

问题看起来涉及依赖于带有“_”前缀的模块(_sqlite3、_ssl)的模块。例如:

 File "C:\ProgramData\anaconda3\Lib\sqlite3\__init__.py", line 23, in <module>
from sqlite3.dbapi2 import *
File "C:\ProgramData\anaconda3\Lib\sqlite3\dbapi2.py", line 27, in <module>
from _sqlite3 import *
ImportError: DLL load failed: The specified module could not be found.

System:

Windows 10

SublimeText3 (freshly reinstalled during troubleshooting)

Python 3.7.3 [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32 (freshly reinstalled during troubleshooting)

命令行和 ST3 或指向相同的 Python 实例。这是机器上唯一安装的 python。

在 ST3 中使用了默认的 Python 构建并创建了一个新构建,两者都有同样的问题。

使用命令行时的结果:

Python 3.7.3 (default, Mar 27 2019, 17:13:21) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.

>>> import plotly

>>>

ST3 的结果:

import plotly

Traceback (most recent call last):
File "C:\Users\usr\Desktop\scrap.py", line 1, in <module>
import plotly
File "C:\ProgramData\anaconda3\Lib\site-packages\plotly\__init__.py", line 32, in <module>
from plotly import (
File "C:\ProgramData\anaconda3\Lib\site-packages\plotly\graph_objs\__init__.py", line 3, in <module>
from plotly.basedatatypes import BaseLayoutType as _BaseLayoutType
File "C:\ProgramData\anaconda3\Lib\site-packages\plotly\basedatatypes.py", line 25, in <module>
from .callbacks import (Points, InputDeviceState)
File "C:\ProgramData\anaconda3\Lib\site-packages\plotly\callbacks.py", line 2, in <module>
from plotly.utils import _list_repr_elided
File "C:\ProgramData\anaconda3\Lib\site-packages\plotly\utils.py", line 262, in <module>
from chart_studio.utils import *
File "C:\ProgramData\anaconda3\Lib\site-packages\chart_studio\__init__.py", line 2, in <module>
from chart_studio import (plotly, dashboard_objs, grid_objs, session)
File "C:\ProgramData\anaconda3\Lib\site-packages\chart_studio\plotly\__init__.py", line 10, in <module>
from . plotly import (
File "C:\ProgramData\anaconda3\Lib\site-packages\chart_studio\plotly\plotly.py", line 38, in <module>
from chart_studio.plotly import chunked_requests
File "C:\ProgramData\anaconda3\Lib\site-packages\chart_studio\plotly\chunked_requests\__init__.py", line 1, in <module>
from . chunked_request import Stream
File "C:\ProgramData\anaconda3\Lib\site-packages\chart_studio\plotly\chunked_requests\chunked_request.py", line 4, in <module>
import ssl
File "C:\ProgramData\anaconda3\Lib\ssl.py", line 98, in <module>
import _ssl # if we can't import it, let the error propagate
ImportError: DLL load failed: The specified module could not be found.
[Finished in 2.9s]

非常感谢任何帮助,已经坚持了好几天。

最佳答案

对于那些将来遇到类似问题的人,我已经通过卸载 Python 的 Anaconda 发行版并将其替换为来自 Python.org 的基本 Python 安装来解决此问题,然后使用 pip 手动安装包。虽然这不是理想的解决方案,但它已经解决了问题,因此当我在 ST3 中构建 Python 脚本时,所有模块都可以正常导入。

关于python - 如何让 Sublime Text 在使用命令行加载文件的地方加载 DLL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56246227/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com