[go: up one dir, main page]

0% found this document useful (0 votes)
13 views15 pages

Virtual Environment Setup (Python)

This document provides detailed steps for installing Java, Python, and Pyenv on a system, including links to download files and videos for guidance. It also outlines how to set environment variables and install additional tools like Pyspark and Vim in VS Code. Instructions for creating and managing virtual environments using pipenv are included as well.

Uploaded by

reheki6971
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views15 pages

Virtual Environment Setup (Python)

This document provides detailed steps for installing Java, Python, and Pyenv on a system, including links to download files and videos for guidance. It also outlines how to set environment variables and install additional tools like Pyspark and Vim in VS Code. Instructions for creating and managing virtual environments using pipenv are included as well.

Uploaded by

reheki6971
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

Steps to Install JAVA in your system

==============================

Install java 1.8 in your system.

Link to install java file:


https://drive.google.com/file/d/1rmcNO-lj5QDQMq0Qpfz7hM0yci1g5o5I/view?usp
=drive_link

Refer the following video to install

https://www.youtube.com/watch?v=ClcHrcNXP9g

In System environment variable, add the path JAVA_HOME (add the path of jdk)

Follow below steps to add the path :


===========================
First copy the path of jdk
Note: You can go to “Programs file” and in that “java folder” will be created in
which you can see jdk and jre folders. Now open that jdk folder and copy that
path.
Now create a JAVA_HOME variable and mention the above path as shown in the
below screenshot.

Then click on the path option and then click on edit in the system variable as
shown below.
Now add the %JAVA_HOME%\bin path as shown below

Installing python locally in windows.


=============================

Follow below steps to install Python locally.

- Download required python version from the below link

https://www.python.org/downloads/
- Select Windows option to check for different versions.

- Download zip file for 64 bit Windows x86-64 executable installer and for 32 bit
Windows x86 executable installer

- Customize installation and follow the steps

Select option Customize installation and select Add Python 3.7 to path as
shown in
Then select the optional feature (refer to the below image).

Create Python folder on C drive. Now install python by browsing this


path(C:\Python)
Note:

To check version of pip run the below command in CMD:

pip --version or pip3 --version

To upgrade pip use the command:

1. Use the below command to upgrade pip

pip install --upgrade pip or pip3 install --upgrade pip

Or

Replace the path of the python.exe file as per your system in below command
and upgrade the pip version locally.

C:\Python\python.exe -m pip install --upgrade pip


To install Pyspark:
==================

Run the command in command prompt (Local)


pip install pyspark

Now to set the path PYSPARK_PYTON follow below process

First go to the environment variable, now in System variable click on new and
add the variable PYSPARK PYTHON and mention the path of the python.exe file
which is which c drive which we installed before refer below screenshot.
Now click on the Path. After that click on edit to add the path of the variable.

Now click on the first option and add the path %PYSPARK_PYTHON% .
Installing vim in vs code:
Installing vim in vs code.

To do that please follow below step:

Go to setting => Extension => search for vim and install it.

Refer from below image.

Now use the command -


vim filename (instead of vi filename).
For creating virtual Environment for the project:

First go to the particular project using cd command using your ide (Ex: VS Code)

To install pipenv use below command

pip install pipenv

To activate environment use the command:

pipenv shell

To exit the virtual environment:


exit

To remove virtual environment:


pipenv –rm
Without activating environment how to run the python

pipenv run python

To exit => exit()

To install pytest in dev run the command:


pipenv install pytest –dev

To uninstall pytest
pipenv uninstall pytest

Installing Pyenv in your system(Local):

Please check the below link to download the pyenv

https://github.com/pyenv-win/pyenv-win

Now click on code and download the zip file


Go to powershell and run the following command to create pyenv directory in
user directory
mkdir $home/.pyenv

Now go to
C => user => <username> and you can see .pyenv folder created.

For below ss username is HP check for your system using above this

And copy files pyenv-win from the extracted files to .pyenv folder refer attached
screenshots
Set the environment variables PYENV and PYENV_HOME that point to the
installation folder:
[System.Environment]::SetEnvironmentVariable('PYENV',$env:USERPROFILE +
"\.pyenv\pyenv-win\","User")
[System.Environment]::SetEnvironmentVariable('PYENV_HOME',$env:USERPR
OFILE + "\.pyenv\pyenv-win\","User")
Add the bin folder to the PATH variable. Such that pyenv can be found when
using the command line.

[System.Environment]::SetEnvironmentVariable('path', $env:USERPROFILE +
"\.pyenv\pyenv-win\bin;" + $env:USERPROFILE + "\.pyenv\pyenv-win\shims;" +
[System.Environment]::GetEnvironmentVariable('path', "User"),"User")

Refer the screenshot

Close the currently open powershell and If you haven’t enabled script execution
yet, start a new PowerShell with admin privileges by right-clicking on the
PowerShell icon in the start menu and choose Run as administrator. Otherwise,
skip this step.

Enter the following command into the PowerShell to enable


the execution of scripts:

Set-Execution-Policy unrestricted

pyenv install --list

pyenv install 3.8.12

You might also like