Я новичок в python, Анаконде и сценариях оболочки. Я хочу запустить несколько сценариев python из приглашения Anaconda или из любой другой оболочки, например:
main.py --epoch 25 --learning_rate .0001
Я работаю над Window10 с Anaconda Navigator 1.9.7
Я использую промо Anaconda, потому что мне нужно активировать специальную среду Python. "активировать myEnv" работает, и "список conda" возвращает все установленные там пакеты. Но я получаю много ModuleNotFoundErrors при запуске сценария. Но в этой среде установлены пакеты, и когда я запускаю сценарий в коде Visual Studio, это нормально. Я добавил некоторые из отсутствующих модулей в базовую среду, и ошибки исчезли, так что, я думаю, оттуда запускается python. Для меня ожидаемое поведение: активация среды в Anaconda Promt и запуск сценария оттуда выполняется в этой среде.
Но, возможно, это проблема пути? Или у меня есть общее недопонимание этого ...
Traceback (most recent call last):
File "D:\Projekte\KI\Python\Creative-Adversarial-Networks GPU Test\main.py", line 131, in <module>
from model import DCGAN
File "D:\Projekte\KI\Python\Creative-Adversarial-Networks GPU Test\model.py", line 5, in <module>
import tensorflow as tf
ModuleNotFoundError: No module named 'tensorflow'
"tensflow" - просто пример, он не смог найти "numpy" и многие другие модули.
sys.path
[
'D:\\Projekte\\KI\\Python\\Creative-Adversarial-Networks GPU Test',
'C:\\Users\\o8\\Anaconda3\\python37.zip',
'C:\\Users\\o8\\Anaconda3\\DLLs',
'C:\\Users\\o8\\Anaconda3\\lib',
'C:\\Users\\o8\\Anaconda3',
'C:\\Users\\o8\\AppData\\Roaming\\Python\\Python37\\site-packages',
'C:\\Users\\o8\\Anaconda3\\lib\\site-packages',
'C:\\Users\\o8\\Anaconda3\\lib\\site-packages\\win32',
'C:\\Users\\o8\\Anaconda3\\lib\\site-packages\\win32\\lib',
'C:\\Users\\o8\\Anaconda3\\lib\\site-packages\\Pythonwin'
]
conda info -a
(tf-gpu1.9) PS C:\Users\o8> conda info
active environment : tf-gpu1.9
active env location : C:\Users\o8\Anaconda3\envs\tf-gpu1.9
shell level : 2
user config file : C:\Users\o8\.condarc
populated config files : C:\Users\o8\.condarc
conda version : 4.8.2
conda-build version : 3.18.11
python version : 3.7.6.final.0
virtual packages : __cuda=10.2
base environment : C:\Users\o8\Anaconda3 (writable)
channel URLs : https://repo.anaconda.com/pkgs/main/win-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/win-64
https://repo.anaconda.com/pkgs/r/noarch
https://repo.anaconda.com/pkgs/msys2/win-64
https://repo.anaconda.com/pkgs/msys2/noarch
package cache : C:\Users\o8\Anaconda3\pkgs
C:\Users\o8\.conda\pkgs
C:\Users\o8\AppData\Local\conda\conda\pkgs
envs directories : C:\Users\o8\Anaconda3\envs
C:\Users\o8\.conda\envs
C:\Users\o8\AppData\Local\conda\conda\envs
platform : win-64
user-agent : conda/4.8.2 requests/2.22.0 CPython/3.7.6 Windows/10 Windows/10.0.18362
administrator : False
netrc file : None
offline mode : False
(tf-gpu1.9) PS C:\Users\o8> conda info -a
active environment : tf-gpu1.9
active env location : C:\Users\o8\Anaconda3\envs\tf-gpu1.9
shell level : 2
user config file : C:\Users\o8\.condarc
populated config files : C:\Users\o8\.condarc
conda version : 4.8.2
conda-build version : 3.18.11
python version : 3.7.6.final.0
virtual packages : __cuda=10.2
base environment : C:\Users\o8\Anaconda3 (writable)
channel URLs : https://repo.anaconda.com/pkgs/main/win-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/win-64
https://repo.anaconda.com/pkgs/r/noarch
https://repo.anaconda.com/pkgs/msys2/win-64
https://repo.anaconda.com/pkgs/msys2/noarch
package cache : C:\Users\o8\Anaconda3\pkgs
C:\Users\o8\.conda\pkgs
C:\Users\o8\AppData\Local\conda\conda\pkgs
envs directories : C:\Users\o8\Anaconda3\envs
C:\Users\o8\.conda\envs
C:\Users\o8\AppData\Local\conda\conda\envs
platform : win-64
user-agent : conda/4.8.2 requests/2.22.0 CPython/3.7.6 Windows/10 Windows/10.0.18362
administrator : False
netrc file : None
offline mode : False
# conda environments:
#
base C:\Users\o8\Anaconda3
env_tensorflow C:\Users\o8\Anaconda3\envs\env_tensorflow
python2.7 C:\Users\o8\Anaconda3\envs\python2.7
tensorflow1 C:\Users\o8\Anaconda3\envs\tensorflow1
tensorflow1x C:\Users\o8\Anaconda3\envs\tensorflow1x
tf-gpu C:\Users\o8\Anaconda3\envs\tf-gpu
tf-gpu1.9 * C:\Users\o8\Anaconda3\envs\tf-gpu1.9
sys.version: 3.7.6 (default, Jan 8 2020, 20:23:39) [...
sys.prefix: C:\Users\o8\Anaconda3
sys.executable: C:\Users\o8\Anaconda3\python.exe
conda location: C:\Users\o8\Anaconda3\lib\site-packages\conda
conda-build: C:\Users\o8\Anaconda3\Scripts\conda-build.exe
conda-convert: C:\Users\o8\Anaconda3\Scripts\conda-convert.exe
conda-debug: C:\Users\o8\Anaconda3\Scripts\conda-debug.exe
conda-develop: C:\Users\o8\Anaconda3\Scripts\conda-develop.exe
conda-env: C:\Users\o8\Anaconda3\Scripts\conda-env.exe
conda-index: C:\Users\o8\Anaconda3\Scripts\conda-index.exe
conda-inspect: C:\Users\o8\Anaconda3\Scripts\conda-inspect.exe
conda-metapackage: C:\Users\o8\Anaconda3\Scripts\conda-metapackage.exe
conda-render: C:\Users\o8\Anaconda3\Scripts\conda-render.exe
conda-server: C:\Users\o8\Anaconda3\Scripts\conda-server.exe
conda-skeleton: C:\Users\o8\Anaconda3\Scripts\conda-skeleton.exe
conda-verify: C:\Users\o8\Anaconda3\Scripts\conda-verify.exe
user site dirs: C:\Users\o8\AppData\Roaming\Python\Python35
C:\Users\o8\AppData\Roaming\Python\Python37
C:\Users\o8\AppData\Roaming\Python\Python38
CIO_TEST: <not set>
CONDA_DEFAULT_ENV: tf-gpu1.9
CONDA_EXE: C:\Users\o8\Anaconda3\Scripts\conda.exe
CONDA_PREFIX: C:\Users\o8\Anaconda3\envs\tf-gpu1.9
CONDA_PREFIX_1: C:\Users\o8\Anaconda3\envs\tensorflow1x
CONDA_PROMPT_MODIFIER: (tf-gpu1.9)
CONDA_PYTHON_EXE: C:\Users\o8\Anaconda3\python.exe
CONDA_ROOT: C:\Users\o8\Anaconda3
CONDA_SHLVL: 2
CUDA_PATH: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2
HOMEPATH: \Users\o8
NVTOOLSEXT_PATH: C:\Program Files\NVIDIA Corporation\NvToolsExt\
PATH: C:\Users\o8\Anaconda3;C:\Users\o8\Anaconda3\Library\mingw-w64\bin;C:\Users\o8\Anaconda3\Library\usr\bin;C:\Users\o8\Anaconda3\Library\bin;C:\Users\o8\Anaconda3\Scripts;C:\Users\o8\Anaconda3\bin;C:\Users\o8\Anaconda3\envs\tf-gpu1.9;C:\Users\o8\Anaconda3\envs\tf-gpu1.9\Library\mingw-w64\bin;C:\Users\o8\Anaconda3\envs\tf-gpu1.9\Library\usr\bin;C:\Users\o8\Anaconda3\envs\tf-gpu1.9\Library\bin;C:\Users\o8\Anaconda3\envs\tf-gpu1.9\Scripts;C:\Users\o8\Anaconda3\envs\tf-gpu1.9\bin;C:\Users\o8\Anaconda3\condabin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\libnvvp;C:\Program Files\Oculus\Support\oculus-runtime;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files\nodejs;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\Git\cmd;C:\Program Files\TortoiseGit\bin;C:\Program Files\NVIDIA Corporation\Nsight Compute 2019.5.0;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Users\o8\AppData\Local\Microsoft\WindowsApps;C:\Users\o8\AppData\Local\GitHubDesktop\bin;C:\Users\o8\AppData\Roaming\npm;C:\Users\o8\Anaconda3\Scripts;C:\Users\o8\Anaconda3\Library\bin;.
PSMODULEPATH: C:\Users\o8\Documents\WindowsPowerShell\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules
REQUESTS_CA_BUNDLE: <not set>
SSL_CERT_FILE: <not set>
Путь, опять же для лучшего чтения:
PATH:
C:Users\o8\Anaconda3;
C:Users\o8\Anaconda3\Library\mingw-w64\bin;
C:Users\o8\Anaconda3\Library\usr\bin;
C:Users\o8\Anaconda3\Library\bin;
C:Users\o8\Anaconda3\Scripts;
C:Users\o8\Anaconda3\bin;
C:Users\o8\Anaconda3\envs\tf-gpu1.9;
C:Users\o8\Anaconda3\envs\tf-gpu1.9\Library\mingw-w64\bin;
C:Users\o8\Anaconda3\envs\tf-gpu1.9\Library\usr\bin;
C:Users\o8\Anaconda3\envs\tf-gpu1.9\Library\bin;
C:Users\o8\Anaconda3\envs\tf-gpu1.9\Scripts;
C:Users\o8\Anaconda3\envs\tf-gpu1.9\bin;
C:Users\o8\Anaconda3\condabin;
C:Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\bin;
C:Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\libnvvp;
C:Program Files\Oculus\Support\oculus-runtime;
C:Program Files (x86)\Common Files\Oracle\Java\javapath;
C:Windows\system32;
C:Windows;
C:Windows\System32\Wbem;
C:Windows\System32\WindowsPowerShell\v1.0;
C:Windows\System32\OpenSSH;
C:Program Files\nodejs;
C:Program Files\Microsoft VS Code\bin;
C:Program Files\Git\cmd;
C:Program Files\TortoiseGit\bin;
C:Program Files\NVIDIA Corporation\Nsight Compute 2019.5.0;
C:Program Files (x86)\NVIDIA Corporation\PhysX\Common;
C:Program Files\NVIDIA Corporation\NVIDIA NvDLISR;
C:Users\o8\AppData\Local\Microsoft\WindowsApps;
C:Users\o8\AppData\Local\GitHubDesktop\bin;
C:Users\o8\AppData\Roaming\npm;
C:Users\o8\Anaconda3\Scripts;
C:Users\o8\Anaconda3\Library\bin;.
PSMODULEPATH:
C:Users\o8\Documents\WindowsPowerShell\Modules;
C:Program Files\WindowsPowerShell\Modules;
C:Windows\system32\WindowsPowerShell\v1.0\Modules
REQUESTS_CA_BUNDLE: <not set>