Skip to content

Instantly share code, notes, and snippets.

@junaidtk
Created August 8, 2020 11:22
Show Gist options
  • Save junaidtk/0a068292915e471fd953cc3ea7ecdba6 to your computer and use it in GitHub Desktop.
Save junaidtk/0a068292915e471fd953cc3ea7ecdba6 to your computer and use it in GitHub Desktop.
Install Python and Create local environment
Install Python and Create local environment
===============================================
Some basic Commands to note i your memory
check selenium is installed or not.
===========================================
$ python3 -c "import selenium; print(selenium.__version__)"
Also to check the selenium installed or not
===========================================
$ python3
>>> import selenium
>>> help (selenium)
To check the brew is installed or not
=====================================
brew list
To check the pip is installed or not
=====================================
pip list
For installing python3 and setup local programing environment in local.
https://www.digitalocean.com/community/tutorials/how-to-install-python-3-and-set-up-a-local-programming-environment-on-macos
To check xcode is installed or not
xcode-select -p
then we will get
/Library/Developer/CommandLineTools
To install Home brew package manager
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
To check home brew installed or not
brew doctor
Then you will get success message as given below.
Your system is ready to brew.
The below command will search list of python available.
brew search python
Then you can install python 3 from there.
brew install python3
Along with Python 3, Homebrew will install pip, setuptools and wheel.
we will use pip to install and manage programming packages we may want to use in our development projects
pip3 install package_name
To check python is ready to use, use this command
python3 --version
To update your version of Python 3, you can first update Homebrew and then update Python:
brew update
brew upgrade python3
To create virtual environment
=================================
Create new directoty and move to this directory
mkdir Environments
cd Environments
Create a virtual environment in that directory
python3.7 -m venv my_env
activate the virtual directory
source my_env/bin/activate
Now you will get the virtual environment with python steup. Now you can run your program.
Then run the python program:
python hello.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment