(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.
C:\code
位 python -V
Python 3.10.5
# What python interpreter is used now
C:\code
位 python -c "import sys; print(sys.executable)"
C:\python310\python.exe
# Test pip(used to install stuff to Python)
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
.
# Activate my environment
C:\code
位 G:\miniconda3\Scripts\activate.bat tom_env
(tom_env) C:\code
位 python -V
Python 3.10.1
# Point to miniconda
(tom_env) C:\code
位 python -c "import sys; print(sys.executable)"
G:\miniconda3\envs\tom_env\python.exe
# Point to miniconda
(tom_env) C:\code
位 pip -V
pip 21.3.1 from G:\miniconda3\envs\tom_env\lib\site-packages\pip (python 3.10)
# Anaconda own installer conda
(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.
(tom_env) C:\code
位 G:
(tom_env) G:\
位 cd div_code
# Run code
(tom_env) G:\div_code
位 python hello.py
hello world
# What python interpreter it used to run code over
(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 .
(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