Ниже приведена моя попытка запустить мой скрипт на Python с использованием CMD.exe с ошибкой, которую я получаю
Microsoft Windows [Version 10.0.17134.765]
(c) 2018 Microsoft Corporation. All rights reserved.
C:\WINDOWS\system32>python
Python 3.7.3 (default, Mar 27 2019, 17:13:21) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Warning:
This Python interpreter is in a conda environment, but the environment has
not been activated. Libraries may fail to load. To activate this environment
please see https://conda.io/activation
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> for p in sys.path: print(p)
...
C:\Users\Garrett\Anaconda3\python37.zip
C:\Users\Garrett\Anaconda3\DLLs
C:\Users\Garrett\Anaconda3\lib
C:\Users\Garrett\Anaconda3
C:\Users\Garrett\AppData\Roaming\Python\Python37\site-packages
C:\Users\Garrett\Anaconda3\lib\site-packages
C:\Users\Garrett\Anaconda3\lib\site-packages\win32
C:\Users\Garrett\Anaconda3\lib\site-packages\win32\lib
C:\Users\Garrett\Anaconda3\lib\site-packages\Pythonwin
>>> import pickle
>>> import os
>>> import sys
>>> filename_FB = 'C:/xampp/htdocs/PD/model/final_gam_FB.sav'
>>> pitchType = 'FB'
>>> V = 90
>>> HB = 12.66
>>> VB = 4.5
>>> U = 0.3
>>> appr_diff = -1.17
>>> with open(filename_FB,'rb') as file: loaded_model_FB = pickle.load(file)
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Garrett\Anaconda3\lib\site-packages\pygam\__init__.py", line 7, in <module>
from pygam.pygam import GAM
File "C:\Users\Garrett\Anaconda3\lib\site-packages\pygam\pygam.py", line 10, in <module>
import numpy as np
File "C:\Users\Garrett\Anaconda3\lib\site-packages\numpy\__init__.py", line 140, in <module>
from . import _distributor_init
File "C:\Users\Garrett\Anaconda3\lib\site-packages\numpy\_distributor_init.py", line 34, in <module>
from . import _mklinit
ImportError: DLL load failed: The specified module could not be found.
>>>
Ниже приведена моя попытка успешно выполнить тот же фрагмент кода с помощью Anaconda Prompt.
(base) C:\Users\Garrett>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 sys
>>> for p in sys.path: print(p)
...
C:\Users\Garrett\Anaconda3\python37.zip
C:\Users\Garrett\Anaconda3\DLLs
C:\Users\Garrett\Anaconda3\lib
C:\Users\Garrett\Anaconda3
C:\Users\Garrett\AppData\Roaming\Python\Python37\site-packages
C:\Users\Garrett\Anaconda3\lib\site-packages
C:\Users\Garrett\Anaconda3\lib\site-packages\win32
C:\Users\Garrett\Anaconda3\lib\site-packages\win32\lib
C:\Users\Garrett\Anaconda3\lib\site-packages\Pythonwin
>>> import pickle
>>> import os
>>> import sys
>>> filename_FB = 'C:/xampp/htdocs/PD/model/final_gam_FB.sav'
>>> pitchType = 'FB'
>>> V = 90
>>> HB = 12.66
>>> VB = 4.5
>>> U = 0.3
>>> appr_diff = -1.17
>>> with open(filename_FB,'rb') as file: loaded_model_FB = pickle.load(file)
...
>>>
Я запускаю свой автоматизированный скрипт с этим в VSCode, и он использует CMD для терминала, и я бы предпочел оставить его таким.Этот процесс работал и в ноутбуке Jupyter.