How to make same Python version in cmd & Anaconda prompt - python

I'm a newbie programmer (little know about computer science BUT Love programming) using windows and have some problems with Python and VS Code in Anaconda. I have v. 3.8.2 as I run python in cmd and v.3.7.4 as I do that in VS Code Terminal (lunched from Anaconda) or in Anaconda prompt. My question is: How I can install the last version of python which becomes the interpreter of both my OS and VS Code in Anaconda? Do I need to uninstall any of them? Thanks a LOT

You need to update them separately.
You can launch Anaconda prompt and type : conda update python
It should by default update the python version in anaconda
Or you can try
To update anaconda type :conda update anaconda
To download Python 3.9 (from Anaconda Prompt)
conda create -c conda-forge python=3.9 -n py39-demo
To update python on your pc go to https://www.python.org/ and download the latest version
However end note for updating python in Anaconda use the top method

Related

Anaconda and miniconda : Conflict in using jupyter notebook or pycharm?

I'm new to the programming environments.
Last year, I had a course where we installed (without understanding what we were doing) miniconda with python 3.7 and jupyter notebook. This year I need anaconda so I installed it with the latest version of python. My question is: will there be a conflict between anaconda and miniconda if I use the shell commands? When I type "jupyter notebook" in the shell, will it open with miniconda which I installed first or anaconda?
Are you on a linux system?
You can try with
type jupyter-notebook
This will show you where the binary is located. For example ~/miniconda3/bin.
The path of the bin-folder of your anaconda/miniconda installation is usually added to your path-variable in the ~/.bashrc file.
PS:
You can find out which version of python/python3 you are using by typing
python --version
or
python3 --version

Do I need to downgrade python from 3.8.2 to 3.7 to run the Anaconda Python 3.7 installer?

I've installed python 3.8.2 and now want to install Anaconda, but there are two versions for macOS: installer for python 3.7 and installer for python 2.7
Does that mean I need to downgrade from 3.8.2 to 3.7.0 for Anaconda? or is the Anaconda installer 3.7+?
Cheers!
https://www.anaconda.com/distribution/#macos
A Python installation from python.org and an Anaconda installation are 2 completely different things and they can live side by side. You don't need to do anything with your existing installation. However, stick to the Anacoda default settings: Don't add Python to your PATH, as this will probably conflict with your other installation. And let conda intialize your command shells. This will add ../Anaconda3/condabin to your PATH and the only thing you need to do before using Anaconda Python is to activate Anaconda, either by using the Anaconda prompt or from your shell via
> conda activate
(base) > python
You can tell from the prefix (base) in the command prompt that Anaconda has been successfully activated.

Python not recognised in windows prompt cmd

Anconda prompt:
where conda
C:\Users\shail\AppData\Local\Continuum\anaconda3\Library\bin\conda.bat
C:\Users\shail\AppData\Local\Continuum\anaconda3\Scripts\conda.exe
C:\Users\shail\AppData\Local\Continuum\anaconda3\condabin\conda.bat
where python
C:\Users\shail\AppData\Local\Continuum\anaconda3\python.exe
C:\Users\shail\AppData\Local\Microsoft\WindowsApps\python.exe
So i went to environment variables and added path of anaconda and python. Path added:
C:\Users\shail\AppData\Local\Continuum\anaconda3
C:\Users\shail\AppData\Local\Microsoft\WindowsApps
C:\Users\shail\AppData\Local\Continuum\anaconda3\Library\bin
C:\Users\shail\AppData\Local\Continuum\anaconda3\Scripts
C:\Users\shail\AppData\Local\Continuum\anaconda3\condabin
But when I type on windows cmd:
C:\Users\shail>conda --version
conda 4.8.3
C:\Users\shail>python --version
C:\Users\shail>
So there is no response from windows cmd on version of python, so I guess it is not recognising python. I mainly need to use pip command, for that I need python first. I dont have python separately installed on system. It is inside my anaconda. On some sites it is written I should not download python separately and add its path because that will confuse the computer since there will be 2 pythons; one from Anaconda and one downloaded separately. So sticking to the anaconda version of python.
How to get my anaconda version of python recognised ?
pip worked for me after restarting my computer. Though python is still not returning any output but pip is working fine.

How can I download Anaconda for python 3.6

I was working on Tensorflow object detection project, for this I am using Anaconda 3 with python 3.7 but I am facing some issues while running object detection demo, I read couple of posts here on stackoverflow and found that it can be solved by using Anaconda with python 3.6 but this version is not available at Anaconda's download page, there are only two versions i.e for Python 3.7 and Python 2.7 but I need for Python 3.6.
Any help would be great.
As suggested here, with an installation of the last anaconda you can create an environment just like Cleb explained or downgrade python :
conda install python=3.6.0
With this second solution, you may encounter some incompatibility issues with other packages. I tested it myself and did not encounter any issue but I guess it depends on the packages you installed.
If you don't want to handle environments or face incompatibilities issues, you can download any Anaconda version here: https://repo.continuum.io/archive/. For example, Anaconda3-5.1.0-XXX or Anaconda3-5.2.0-XXX provides python 3.6 (the suffix XXX depends on your OS).
To know which python is provided in an anaconda package, you can visit the Release notes page. It provides the updates for the all anaconda versions. Find yours and look for the line
python A.B.C -> X.Y.Z
where A.B.C is the previous version and X.Y.Z is the updated python version.
This link has history version about Anaconda, you could download from this website.
At version 5.3.0 python 3.6 support was dropped...
Anaconda 5.3.0 (Sept 28, 2018)
User-facing changes
The Anaconda3 installers ship with python 3.7 instead of python 3.6
python 3.6.5 -> 3.7.0
https://docs.anaconda.com/anaconda/reference/release-notes/#anaconda-5-3-0-sept-28-2018
The last version released with a python3.6 variant was version 5.2.0
Anaconda 5.2.0 (May 30, 2018)
python 3.6.4 -> 3.6.5
https://docs.anaconda.com/anaconda/reference/release-notes/#anaconda-5-2-0-may-30-2018
The links to this latest version are...
Anaconda3-5.2.0-Linux-ppc64le.sh
Anaconda3-5.2.0-Linux-x86.sh
Anaconda3-5.2.0-Linux-x86_64.sh
Anaconda3-5.2.0-MacOSX-x86_64.pkg
Anaconda3-5.2.0-MacOSX-x86_64.sh
Anaconda3-5.2.0-Windows-x86.exe
Anaconda3-5.2.0-Windows-x86_64.exe
You can download the 3.7 version and then use
conda create -n mygreatenvironment python=3.6 <add other packages here>
and then:
conda activate mygreatenvironment
This environment will use Python 3.6.
Following this answer, this solution is working for me on windows 10,
From the anaconda prompt :
Create a custom environnement and specify the repository channel to find the version (in my case 3.6.5)
conda create --name py365 python=3.6.5 --channel conda-forge
Activate the new environment
conda activate py365
But the activation won't be permanent, you will need to activate each time you start the anaconda prompt
Create a shortcut to Anaconda prompt with your choosen environment
In order to activate permanently your custom environment, you can create a anaconda prompt shortcut which new target.
Go to
C:\Users\Your_Name\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Anaconda3 (64-bit)
And Copy and rename the file Anaconda Prompt (Anaconda3) to Anaconda 3.6.5.
Then right-click on the new file and click on "Properties".
Then change the target :
%windir%\System32\cmd.exe "/K" C:\Users\Your_Name\Anaconda3\Scripts\activate.bat C:\Users\Your_Name\Anaconda3
to
%windir%\System32\cmd.exe "/K" C:\Users\Your_Name\Anaconda3\Scripts\activate.bat C:\Users\Your_Name\Anaconda3\envs\py365
(be aware to change "Your_Name" by your "real" name )
Finally, if you go to your Windows Start menu, you will see your new shortcut "Anaconda 3.6.5" which launch the Anaconda Prompt with your choosen environment !
You can download anaconda from the archives.
The path I followed was:
Anaconda Documentation>Anaconda Distribution>Installation-(in page)System Requirements>archive
I was looking for installation instructions on my CentOS machine when I stumbled upon the question.
For installing python 3.6 on windows go to this link

How to install 2 Anacondas (Python 2 and 3) on Mac OS

I'm relatively new in macOS. I've just installed XCode (for c++ compiler) and Anaconda with the latest Python 3 (for myself). Now I'm wondering how to install properly second Anaconda (for work) with Python 2?
I need both versions to work with iPython and Spyder IDE. Ideal way is to have totally separate Python environments. For example, I wish I could write like conda install scikit-learn for Python 3 environment and something like conda2 install scikit-learn for Python 2.
There is no need to install Anaconda again. Conda, the package manager for Anaconda, fully supports separated environments. The easiest way to create an environment for Python 2.7 is to do
conda create -n python2 python=2.7 anaconda
This will create an environment named python2 that contains the Python 2.7 version of Anaconda. You can activate this environment with
source activate python2
This will put that environment (typically ~/anaconda/envs/python2) in front in your PATH, so that when you type python at the terminal it will load the Python from that environment.
If you don't want all of Anaconda, you can replace anaconda in the command above with whatever packages you want. You can use conda to install packages in that environment later, either by using the -n python2 flag to conda, or by activating the environment.
Edit!: Please be sure that you should have both Python installed on your computer.
Maybe my answer is late for you but I can help someone who has the same problem!
You don't have to download both Anaconda.
If you are using Spyder and Jupyter in Anaconda environmen and,
If you have already Anaconda 2 type in Terminal:
python3 -m pip install ipykernel
python3 -m ipykernel install --user
If you have already Anaconda 3 then type in terminal:
python2 -m pip install ipykernel
python2 -m ipykernel install --user
Then before use Spyder you can choose Python environment like below!
Sometimes only you can see root and your new Python environment, so root is your first anaconda environment!
Also this is Jupyter. You can choose python version like this!
I hope it will help.
This may be helpful if you have more than one python versions installed and dont know how to tell your ide's to use a specific version.
Install anaconda. Latest version can be found here
Open the navigator by typing anaconda-navigator in terminal
Open environments. Click on create and then choose your python version in that.
Now new environment will be created for your python version and you can install the IDE's(which are listed there) just by clicking install in that.
Launch the IDE in your environment so that that IDE will use the specified version for that environment.
Hope it helps!!

Categories

Resources