(Sep-03-2022, 08:28 AM)reddwarfcrew Wrote: So can I use via to execute the py script via the conda prompt (ie with base activated)?
Yes when
base
is active it will use the Anaconda python version no matter what folder you are in.
Can give some tips as i have lot installed and Python versions never interfere if understand how this works.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
C:\code
λ python - V
Python 3.10 . 5
C:\code
λ python - c "import sys; print(sys.executable)"
C:\python310\python.exe
C:\code
λ pip - V
pip 22.2 . 2 from C:\python310\lib\site - packages\pip (python 3.10 )
|
So over is a Python version from
python.org
Now will use a
Miniconda(same as Anaconda without all 720 packages pre-installed) and activate a environment my own,but works the same as
base
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
C:\code
λ G:\miniconda3\Scripts\activate.bat tom_env
(tom_env) C:\code
λ python - V
Python 3.10 . 1
(tom_env) C:\code
λ python - c "import sys; print(sys.executable)"
G:\miniconda3\envs\tom_env\python.exe
(tom_env) C:\code
λ pip - V
pip 21.3 . 1 from G:\miniconda3\envs\tom_env\lib\site - packages\pip (python 3.10 )
(tom_env) C:\code
λ conda - V
conda 4.11 . 0
|
See that now use a other Python version from Miniconda.
Lest say a have
hello.py
in folder
G:\div_code
,can now navigate and run the .py file,as long as
(tom_env)
or eg
(base)
is activate it will always use the Miniconda Python version.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
(tom_env) C:\code
λ G:
(tom_env) G:\
λ cd div_code
(tom_env) G:\div_code
λ python hello.py
hello world
(tom_env) G:\div_code
λ python - c "import sys; print(sys.executable)"
G:\miniconda3\envs\tom_env\python.exe
|
Deactivate it will my other Python version .
1 2 3 4 5 6 7 8 9 10 |
(tom_env) G:\div_code
λ conda deactivate
G:\div_code
λ python hello.py
hello world
G:\div_code
λ python - c "import sys; print(sys.executable)"
C:\python310\python.exe
|