简体   繁体   中英

Conda version of python still active even when I deactivate conda

I have ubuntu 2022LTS with python 3.10.4 and numpy installed.

But since I installed miniconda, I cannot get back to my original system installation of python even when I deactivate conda:

prokophapala@ProkopDesktop:~$ conda activate
(base) prokophapala@ProkopDesktop:~$ python --version
Python 3.9.12
(base) prokophapala@ProkopDesktop:~$ conda deactivate
prokophapala@ProkopDesktop:~$ python --version
Python 3.9.12
prokophapala@ProkopDesktop:~$ python3
Python 3.9.12 (main, Apr  5 2022, 06:56:58) 
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'numpy'
>>> 

Activating a conda environment means that the location of the Python interpreter and the C-libraries (numpy) are temporarily added to the system path. After deactivation the old system path is restored.

Obviously during miniconda installation you enabled the option to "Add Python to the system path" which is not the default option and which is not recommended, since you can't access your previous Python any more.

So the solution is to check your system path, remove all miniconda Python references (except for the path to condabin) and add the path to your previous Python again. Note that you can have both interpreters in parallel on your system, but you always have to activate a conda environment before you can use it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM