Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install Miniconda in Ubuntu

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

How to install Miniconda in Ubuntu, for this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and easy way.

Explain why conda is used to create a python environment

Now there are many linux-based distributions, such as centos,ubuntu,redHat, etc. In general, linux-based derivative systems, at least installed with the Python2 version, but now Python is 3.x version popular.

When we install the python3.x version of these systems, we need to go through a series of operations and various tedious operations, because the python2.x version of the system can not be uninstalled, otherwise unknown errors may occur, and we also need to solve a variety of inexplicable problems and various dependencies.

Friends who have experienced it may have a lot of experience, and friends who have not experienced it are better.

However, if we use conda and create various versions of python with the help of conda, it will be much easier, and the pip we use is also the pip of the current environment, which will not conflict with the original system pip, and the installation of conda is also very easy, don't worry about this.

download

Transfer files to each other through winScp and linux

Many people recommend using rz or command-line tools to transfer files to and from linux systems on win systems, but I don't recommend them here.

What I recommend is to give visual intercommunication software, winscp, simple and convenient, without hair loss. If you need this software, you can add me in the background and send you privately.

Use steps

Installation

open

According to the prompt, connect to linux and drag the file left or right

File: WinSCPSetup.exe

Note:

On linux, downloading files can also be downloaded through the wget command, but I still don't recommend it, because there are N ways to download files on win, but on linux, if you can't download files under wegt, it's very difficult.

Personal advice is to download the file on win and drag it through winScp.

Install Miniconda

Drag and drop the executable file of Miniconda linux onto linux via winScp

Execute a command

Bash Miniconda3-latest-Linux-x86_64.sh

There is no problem when there is a Welcome to Minxxxxx representative, and then you enter all the time. You may encounter More, and you still enter all the time, so you don't have to worry about missing anything.

Until you encounter Do you accept the license terms? [yes | no]

Select yes

Here, select the installation location of Miniconda3, select enter here, and select the default

Waiting for installation

Whether to initialize, and the environment variable will be added, select yes

Thank you for xxxx... appears

Execute the command to refresh the environment variable. Enter conda and the following appears, indicating success

Source .bashrc

Where is the installation location of Miniconda?

The installation location is in the user directory, so you can't execute the rm-rf * command, or you'll have to reinstall it.

There has always been a (base) ahead.

You may carefully find that after executing source .bashrc, there will be one in front of you (base), and there will be a new session (base).

This actually represents the activation of the base (most basic) environment. But it's not usually needed. We need to get back to the way we used to be.

Solution method

Execute the command in turn

Conda deactivate

Conda config-set auto_activate_base false

Effect.

After execution (base) will automatically disappear, and the new session will not have (base)

Conda common commands

Here are the commonly used commands. There are some commands that are not listed. Check the manual yourself.

Basic command

On linux and win, there are some differences between commands. Conda is needed on linux.

# get version number conda-V # Update conda conda update conda # View Virtual Environment list conda env list # View-install-Update-Delete package conda list: conda search package_name# query package conda install package_name conda install package_name=1.5.0 conda update package_name conda remove package_name

Chestnut

Create a virtual environment

Conda create-- name [python_version] [package_name]

Parameter interpretation indicates required parameters, and [] indicates optional parameters.

Env_name: virtual environment name

Python_version: specify the version of python

Package_name: contains installed third-party packages

Chestnut

# create an environment named spider conda create-- name spider # create an python3.6 version, an environment named spider conda create-- name spider python=3.6 # create an environment conda create-- name spider requests that contains certain packages (requests,scrapy), # create a python3.6 version that contains the requests package, an environment named spider conda create-- name spider python=3.6 requests

Enter the virtual environment

Conda activate

Parameter interpretation indicates required parameters, and [] indicates optional parameters.

Env_name: virtual environment name

Chestnut

# enter spider virtual environment conda activate spider

Exit the virtual environment (can only be used when you enter the environment)

Conda deactivate

Chestnut

Install a third-party package

The method used here is installed through pip

After conda activates a virtual environment, it also uses the current python and pip, so you don't have to worry about conflicts with the pip of the original system.

Steps

Hongmeng official Strategic Cooperation to build HarmonyOS Technology Community

Enter the specified virtual environment activate

Direct pip install

Chestnut

This is the answer to the question about how to install Miniconda in Ubuntu. I hope the above content can be of some help to you. If you still have a lot of doubts to solve, you can follow the industry information channel for more related knowledge.

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report