How to Setup a Python Virtual Environment

Virtual Environment is necessary when you have many projects with different requirements, You can use python2 or python3 without worrying about collision and keep then main python folder clean

Install python virtual environment

>> sudo apt-get install updates
>> sudo apt-get install python3-venv
>> sudo apt-get install updates
>> sudo apt-get install python3-venv
>> sudo apt-get install updates >> sudo apt-get install python3-venv

Enter fullscreen mode Exit fullscreen mode

Create project folder

>> mkdir project_folder_name
>> cd project_folder_name/
>> mkdir project_folder_name
>> cd project_folder_name/
>> mkdir project_folder_name >> cd project_folder_name/

Enter fullscreen mode Exit fullscreen mode

Initialize a virtual environment

>> python3 -m venv virtual_env_name
>> python3 -m venv virtual_env_name
>> python3 -m venv virtual_env_name

Enter fullscreen mode Exit fullscreen mode

To activate virtual_env

>> source virtual_env_name/bin/activate
>> source virtual_env_name/bin/activate
>> source virtual_env_name/bin/activate

Enter fullscreen mode Exit fullscreen mode

To deactivate virtual_env

>> deactivate
>> deactivate
>> deactivate

Enter fullscreen mode Exit fullscreen mode

原文链接:How to Setup a Python Virtual Environment

© 版权声明
THE END
喜欢就支持一下吧
点赞8 分享
All things in their being are good for something.
天生我才必有用
评论 抢沙发

请登录后发表评论

    暂无评论内容