gpt4 book ai didi

python - 导入错误 : Missing required dependencies ['numpy' ] ONLY when running from . bat 文件

转载 作者:行者123 更新时间:2023-12-03 11:07:13 32 4
gpt4 key购买 nike

我在装有 Windows 10 的 Anaconda 发行版上运行 Python 3.7。

我有一个脚本可以在 Spyder ipython 控制台中正常运行。但是,我需要从 .bat 文件运行它。

我用以下 Python 代码(只是导入)复制了错误:

import pandas

以及以下 .bat:

C:\Users\user\Anaconda3\python "L:\path\baterrorimporttest.py"

我收到以下错误:

Traceback (most recent call last):
File "L:\path\baterrorimporttest.py", line 1, in <module>
import pandas
File "C:\Users\user\Anaconda3\lib\site-packages\pandas\__init__.py", line 19, in <module>
"Missing required dependencies {0}".format(missing_dependencies))
ImportError: Missing required dependencies ['numpy']

我在 Spyder 控制台中运行此脚本、导入 pandas、使用 numpy 等都没有问题。

有什么建议吗?

最佳答案

我使用这段代码:

call "C:\Anaconda\Scripts\activate.bat" "C:\Anaconda"
"C:\Anaconda\python.exe" "C:\Users\...\ml001.py"
pause

关于python - 导入错误 : Missing required dependencies ['numpy' ] ONLY when running from . bat 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55768343/

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