Friday, 14 October 2022

Creating python environment in 5 ways

 python environment are created several ways

before creating environment install python software on os level

https://www.python.org/ftp/python/3.10.8/python-3.10.8-amd64.exe

environment are used to separate corresponding projects requirement libraries independent with another projects ,it will also helps to versioning your projects like , one environment may be using python 3.7 version another will be python version 3.8 version


lets create a envirnment myenv

1.python -m venv myenv 

myenv folder is created after executing this comment

inside myenv you can see activate file by opening scripts or bin


there are lots of ways creating environment





to activate the environment,use the below comment

find the path of activate file in my case activate file is located D:\projects\test13\testproj\myenv\Scripts\

so I can activate myenv like 

myenv\Scripts\activate

because i am already in  D:\projects\test13\testproj\ so i need only go from testproj folder "myenv\Scripts\"

or 

by full path

 D:\projects\test13\testproj\myenv\Scripts\activate 



I usually use this method and recommend using this simple way , you can try other methods also

2. python -m virtualenv .

. (the dot is used to create env on the current folder)

for this, you may need to install

pip install virtualenv


3.mkvirtualenv myenv 

using python wrapper

pip install virtualenv
pip install virtualenvwrapper-win ( do not use pip install virtualenvwrapper)

4. you can use pycharm software (download and install pycharm)

5. using anaconda 

Please note:-

Now onwards i will use env for environment 

No comments:

Post a Comment