In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-12 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly shows you how to install Python3 in Ubuntu20.04 in a virtual environment, the content is simple and easy to understand, I hope you can learn, after learning, there will be a harvest, the following let the editor take a look at it.
The following is done on my virtual machine.
1. Install pip3
Sudo apt install python3-pip
two。 Install a virtual environment
Sudo apt install virtualenvsudo apt install virtualenvwrapper
3. Modify the configuration file to set environment variables
Cd ~
Vim .bashrc
Add the following two lines after the .bashrc file
Export WORKON_HOME=$HOME/.virtualenvs source / usr/share/virtualenvwrapper/virtualenvwrapper.sh
Among them, the sentence "usr/share/virtualenvwrapper/virtualenvwrapper.sh" is different from other Ubuntu versions. Other bosses are "source / usr/local/bin/virtualenvwrapper.sh" on Ubuntu18.04, and the specific file location can be found and filled in.
Tip: if you can't find virtualenvwrapper.sh, you can use the following command to find the path where the file is located and change the path you found.
Sudo find /-name virtualenvwrapper.sh
4. Enable profile
Source .bashrc
At this point, the virtual environment can be created normally.
PS: let's take a look at Python3 to create a virtual environment
Purpose
Virtual environments are used to isolate Python libraries between different projects
Create a virtual environment
Python3 has a built-in venv module. First create a project directory. After entering the directory, execute
Python3-m venv venv
Activate the virtual environment
Before you start working, activate the appropriate virtual environment:
. Venv/bin/activate
Under Windows:
Venv\ Scripts\ activate
When activated, your terminal prompt displays the name of the virtual environment.
Install the appropriate modules, such as:
Pip install Flask
The above is about how to install Python3 in Ubuntu20.04 in a virtual environment. If you have learned knowledge or skills, you can share it for more people to see.
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.