In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly talks about "how to solve the Anaconda of the coexistence of Python2 and python3". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to solve the Anaconda of the coexistence of Python2 and python3.
What is Anaconda?
Anaconda is a distribution of Python. If Python is compared to Linux, then Anancoda is CentOS or Ubuntu. It solves two major pain points for Python developers.
The first is to provide package management, which is similar to the scenario in which third-party packages often fail to install on the pip,Windows platform.
Second, it provides virtual environment management, which is similar to virtualenv and solves the problem of the coexistence of multiple versions of Python.
Download Anaconda
Download the latest version of the https://www.continuum.io/downloads installation package directly from the official website, select the Python3.6 version of the installation package, and install it directly after the download is completed. You can choose the default configuration during the installation process, which requires about 1.8g of disk space.
Conda is a command-line tool for package management and environment management under Anaconda, and it is a combination of pip and vitualenv. After successful installation, conda is added to the environment variable by default, so you can run the conda command directly in the command line window
If you are familiar with virtualenv, it is very easy to get started with conda, and it doesn't matter if you are not familiar with virtulenv. It provides only a few commands, which are very simple. We can use the virtual environment management function of conda to switch freely between Python2 and Python3.
Multi-version switching # create an environment called test_py3 based on python3.6 conda create-- name test_py3 python=3.6 # create an environment called test_py2 based on python2.7 conda create-- name test_py2 python=2.7# activate test environment activate test_py2 # windowssource activate test_py2 # linux/mac# switch to python3activate test_py3
For more commands, see help conda-h
Package management tool
Conda's package management capabilities are a complement to pip, and if a Python environment is currently active, you can start installing third-party packages in the current environment.
# install matplotlib conda install matplotlib# to view the installed package conda list # package update conda update matplotlib# delete package conda remove matplotlib
For those modules that cannot be successfully installed with pip, you can try to install them with conda. If you can't find the corresponding package with conda, of course you can continue to choose pip to install the package.
Increase download speed
The image address of Anaconda is abroad by default, and it will be slow to install the package with conda. Currently, the available domestic image source address is provided by Tsinghua University. Modify ~ / .condarc (Linux/Mac) or C:\ Users\ current username .condarc (Windows) configuration
Channels:-https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/-defaultsshow_channel_urls: true
In addition, you can also change the image source address of pip to a domestic one. Douban source is faster. Modify ~ / .pip/pip.conf (Linux/Mac) or C:\ Users\ current user name\ pip\ pip.ini (Windows) configuration:
[global] trusted-host = pypi.douban.comindex-url = http://pypi.douban.com/simple so far, I believe you have a deeper understanding of "how to solve the Anaconda of the coexistence of Python2 and python3". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.