I installed Anaconda and now there's a (base) before the shell username in the terminal. I am also not able to use the default python by python command in the terminal as it calls the anaconda python. Also can't switch the python interpreter in vs code. (Nothing happens when I try)Any way I can reset it back. I have python 3.8.2 as default in my Linux fedora os.
Thank You
You can go to your bashrc
/etc/bashrc
and add a new alias for your default python location which you'll use for calling default python.
alias python_default='.../bin/python3'
alias python_conda='.../bin/python3'
Related
I work on an api that run python3 scripts like python3 <scriptname.py>. This api initially run on a linux system. Unfortunately I make the local development of it on a windows. Is there a way to simulate this behaviour so that when I run in powershell python3 -V it give me the version of python.
I have allready python 3 installed on my computer. I tried to add the path to my python.exe to the system variables with for variable the string python3. But after registering and restarting powershell and type python3 -V I still get the error that «python3» is not recognized as a command applet name.
Does anyone have any ideas?
Once python is in your path, you can define a PowerShell alias for python3.
PS > New-Alias python3 python
PS > python3 -V
python 3.6.5
In order to have this alias as a permanent one, refer to this question: Permanent PowerShell Aliases.
I found tricky solution.
Once python is in your path, go to python installed path and copy python.exe and named duplicated one as python3.exe
I am running the latest Anaconda Python 3.6. I would like to switch to Python 2.7 system wide.
I searched around and found a way to change the python environment in MacOS by creating a new python environment and then running source activate python2. Great, but that only works in the current terminal session.
(python2) $ ~/
I have Eclipse IDE running that needs Python 2.7 for certain things. I can just dereference Anaconda in the path by changing the ~/.bash_profile, but that's not my question. I am looking for a way to change the default Ananconda python environment from 3.4 to 2.7 system wide and not just in one terminal session.
I found this in the comments:
conda config --set core.default_env=python2
but I am getting an error:
conda config: error: argument --set: expected 2 arguments
Surely, there must be a way to switch Anaconda based environments system wide?
Okay, so I have python 3.5 on my system (Ubuntu 16.04). Whenever I open a .py file, Idle3 starts, thus pressing F5 will instantly run my code.
However I need python 2.7 now for an assignment. In terminal I've apt-get install idle so, I can open idle and idle3 there easily.
My problem is, I can't change my .py files' default application to idle. It only sees idle3, so I can't open my files with idle(2.7) as default.
Tried to make an alias in ~/.bash_aliases as alias python=/usr/local/bin/python2.7, but typing python --version into terminal I get:
-bash: /usr/local/bin/python2.7: No such file or directory.
Typing python2 --version and python3 --version works fine.
Is there any simple workaround for that?
Type whereis python2 on your terminal; you end up getting possibly one or more paths to python2. You can then copy-paste any of these paths onto your alias for python in .bash_aliases.
Change default python in Ubuntu
This link gives you an idea about changing the default python version.
I have 2 different versions of python installed on my system i.e. 2.6.6 and 2.7.9.
I am running python scripts on linux via QTP(using paramiko on windows). I execute the following sample of code to execute commands.
"python /dir/of/frameword/ somecode"
When I hit this command the default version of python is used to create the shell that is 2.6.6
Is there any way that I could instruct the linux to pick up 2.7.9 with a command like "python27".
I have also added an alias in ./bashrc but that also dosent help.
set up a shell alias
alias python=/usr/local/bin/python2.7
PS:have you run source ~/.bashrc after save ~/.bashrc?I noticed you mention ./bashrc instead of ~/.bashrc,is it a spelling mistake?
use virtualenv
On the advice of my supervisor, I switched my shell over from bash to tcsh. However, I'm having trouble getting my Anaconda install to set to be the default python in tcsh as it was in bash.
I need to know the .tcshrc equivalent of
export PATH="/home/george/anaconda3/bin:$PATH"
which the Anaconda installer automatically placed in my .bashrc file. I have searched for ages on Google for the right syntax, but whatever I enter in the .tcshrc file doesn't seem to work for me.
This is the equivalent in the .cshrc file:
set path = (/home/georg/anaconda3/bin $path)
To set the PATH for a C Shell(tcsh) you would need to set it with the following syntax:
setenv PATH $PATH\:<path to anaconda/bin>
By default Anaconda would store it in Linux under:
/home/username/anaconda/bin
Mac OS X:
/Users/username/anaconda/bin
Windows:
C:\Users\username\Anaconda
C:\Users\username\Anaconda\Scripts
EDIT:
To make this persistent in Mac OS X I created ~/.login and added the above command.