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 Python virtual environment for Ubuntu18.04

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

Share

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

This article mainly introduces Ubuntu18.04 how to install Python virtual environment, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.

1. Install the Ubuntu18.04 virtual environment

Sudo apt install virtualenvsudo apt install virtualenvwrapper

After the installation is complete, go to the home directory and type the command ls-al to see if the .virtualenvs directory appears. If not, create the .virtualenvs directory manually.

two。 Install modules in the Python environment that can support virtual environments (I am using Python3.6 here)

Pip3 install virtualenvpip3 install virtualenvwrapper

3. Configure the virtual management directory

Enter the home directory, enter the command ls-al, find the .bashrc file, and modify the .bashrc file.

Add two lines at the end of the .bashrc file:

Export WORKON_HOME=$HOME/.virtualenvssource / usr/share/virtualenvwrapper/virtualenvwrapper.sh

4. Enable profile

Source / .bashrc

5. Check whether a virtual environment can be created

Create a virtual environment using the mkvirtualenv project name. If it is successful, the Ubuntu18.04 virtual environment is created successfully.

PS: let's take a look at the Ubuntu 18.04 installation & creating a virtual environment

Install and configure the virtual environment

Install a virtual environment

Sudo apt install virtualenvsudo apt install virtualenvwrapper

Configure the virtual management directory (ctrl + h can open the hidden file under the home directory and you can see .bashrc)

1. Create a directory to store the virtual environment

Mkdir $HOME/.virtualenvs

two。 Add a line to ~ / .bashrc:

Export WORKON_HOME=$HOME/.virtualenvssource / usr/share/virtualenvwrapper/virtualenvwrapper.sh

Second, enable configuration files

Source / .bashrc

Thank you for reading this article carefully. I hope the article "how to install Python Virtual Environment in Ubuntu18.04" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you 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.

Share To

Servers

Wechat

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

12
Report