Anaconda обновить версию python

Keeping Anaconda Up To Date

Below is a question that gets asked so often that I decided it would be helpful to publish an answer explaining the various ways in which Anaconda can be kept up to date. The question was originally asked on StackOverflow.

I have Anaconda installed on my computer and I’d like to update it. In Navigator I can see that there are several individual packages that can be updated, but also an anaconda package that sometimes has a version number and sometimes says custom. How do I proceed?

The Answer

What 95% of People Actually Want

In most cases what you want to do when you say that you want to update Anaconda is to execute the command:

This will update all packages in the current environment to the latest version—with the small print being that it may use an older version of some packages in order to satisfy dependency constraints (often this won’t be necessary and when it is necessary the package plan solver will do its best to minimize the impact).

Читайте также:  Добавить php скрипт joomla

This needs to be executed from the command line, and the best way to get there is from Anaconda Navigator, then the “Environments” tab, then click on the triangle beside the root environment, selecting “Open Terminal.”

This operation will only update the one selected environment (in this case, the root environment). If you have other environments you’d like to update you can repeat the process above, but first click on the environment. When it is selected there is a triangular marker on the right (see image above, step 3). Or, from the command line, you can provide the environment name ( -n envname ) or path ( -p /path/to/env ). For example, to update your dspyr environment from the screenshot above:

Update Individual Packages

If you are only interested in updating an individual package then simply click on the blue arrow or blue version number in Navigator, e.g. for astroid or astropy in the screenshot above, and this will tag those packages for an upgrade. When you are done you need to click the “Apply” button.

conda update astroid astropy 

Updating Just the Packages in the Standard Anaconda Distribution

If you don’t care about package versions and just want “the latest set of all packages in the standard Anaconda Distribution, so long as they work together,” then you should take a look at this gist.

Why Updating the Anaconda Package is Almost Always a Bad Idea

In most cases, updating the Anaconda package in the package list will have a surprising result—you may actually downgrade many packages (in fact, this is likely if it indicates the version as custom ). The gist above provides details.

Leverage conda Environments

Your root environment is probably not a good place to try and manage an exact set of packages—it is going to be a dynamic working space with new packages installed and packages randomly updated. If you need an exact set of packages, create a conda environment to hold them. Thanks to the conda package cache and the way file linking is used, doing this is typically fast and consumes very little additional disk space. For example:

conda create -n myspecialenv -c bioconda -c conda-forge python=3.5 pandas beautifulsoup seaborn nltk 

The conda documentation has more details and examples.

pip, PyPI, and setuptools?

None of this is going to help with updating packages that have been installed from PyPI via pip , or any packages installed using python setup.py install . conda list will give you some hints about the pip-based Python packages you have in an environment, but it won’t do anything special to update them.

Commercial Use of Anaconda or Anaconda Enterprise

It’s pretty much exactly the same story, with the exception that you may not be able to update the root environment if it was installed by someone else (say, to /opt/anaconda/latest ). If you’re not able to update the environments you are using, you should be able to clone and then update:

conda create -n myenv --clone root conda update -n myenv --all

Where to Go Next

If you have more questions about Anaconda then you can refer to our online documentation, or make use of our commercial (paid) or community (free) support channels. If you are using Anaconda in an enterprise setting, then I think you’ll be interested in learning about how Anaconda can help you and your colleagues with collaboration, security, governance, and provenance around your data science workflows.

Источник

Updating from older versions#

Follow the instructions below to update Anaconda to the latest version.

These steps assume you are starting in the base environment created by the installer.

To update to the latest version of Anaconda, enter these commands:

#update the conda package manager to the latest version conda update conda #use conda to update Anaconda to the latest version conda update anaconda 

To update to a specific version of Anaconda, enter these commands:

#update the conda package manager to the latest version conda update conda #use conda to install a specific version of Anaconda conda install anaconda=VERSION-NUMBER 

More information#

The below content provides more details about what is happening when you update Anaconda.

conda install anaconda=VERSION-NUMBER grabs the specific release of the Anaconda metapackage; for example, conda install anaconda=2022.05 . That metapackage represents a pinned state that has undergone testing as a collection. Read more about metapackages.

There is a special “custom” version of the Anaconda metapackage that has all the package dependencies, but none of them are constrained. The “custom” version is lower in version ordering than any actual release number. conda install anaconda=VERSION-NUMBER may remove packages if the new metapackage that is replacing your old one has removed packages. As of conda 4.7, when a package loses its connection to the set of specs that have been requested in the past, it gets removed.

conda update —all will unpin everything. This updates all packages in the current environment to the latest version. In doing so, it drops all the version constraints from the history and tries to make everything as new as it can.

Removing packages has the same behavior. If any packages are orphaned by an update, they are removed. conda update —all may not be able to make everything the latest versions because you may have conflicting constraints in your environment.

With Anaconda 2019.07’s newer Anaconda metapackage, conda update —all will make the metapackage go to the custom version in order to update other specs.

conda update —all will only update the selected environment. If you have other environments you’d like to update, update them in the command line with the following:

When you use conda update pkgName or conda install pkgName , conda may not be able to update or install that package without changing something else you specified in the past.

In the case of the Anaconda metapackage, when you enter conda update ipython but you have Anaconda 2019.03 currently installed, conda can and should “downgrade” Anaconda to the “custom” version so that iPython can be updated.

When conda cannot fulfill the request for the latest package available, it usually means that newer packages exist for your spec but are in conflict. To force the change, try conda install = .

Verifying your installation

Источник

Change the Python Version in Anaconda

Change the Python Version in Anaconda

  1. Use the conda install Command on the Anaconda Command Prompt
  2. Use the Latest Anaconda Installer
  3. Use the conda create Command on the Anaconda Command Prompt
  4. Use the conda update Command on the Anaconda Command Prompt

This article introduces various methods to change the Python version in Anaconda.

Once you change the Python version on the Anaconda command prompt, you can use the following command to display the current version of Python.

Use the conda install Command on the Anaconda Command Prompt

Use the conda install command on the Anaconda command prompt to change the Python version. Follow this example below.

conda install python=the_version> 

Use the Latest Anaconda Installer

Use the latest Anaconda installer to update the Python version. It is a graphical installer.

You will find the newer versions of Python here.

You will find the older versions of Python here.

Use the conda create Command on the Anaconda Command Prompt

If you’d like to install the new version of Python in a particular environment, you could use the conda create command.

conda create -n my_environment> python=new_version> 

Here’s another method you can follow.

conda create -n an_env python=3.5 

Post that, you need to activate the environment using the command below.

conda activate my_environment> 

You can also issue the command in the following way.

Use the conda update Command on the Anaconda Command Prompt

If you want to change the version of Python to the latest version, you can do so by utilizing conda update command. Here’s the program you can do.

Copyright © 2023. All right reserved

Источник

Оцените статью