Hello there, in this short note I'll show you how to create a python virtual environment for a new project and walk you through the process of resolving some common conflicts you might get while creating a virtual environment for your projects.
First things first, you will need to make sure python and pip are installed properly
to check this just run the stuff below in your favourite terminal
$ python --version
if you an error like the one below, it probably because you don't have python correctly installed or you it haven't be added to your system environment variables path
Here's how to add it yourself
type "edit system environment variable" - follow the images below to get it resolved
Once you type that stuff from before, it should land you here, look to the bottom where it says environment variable CLICK IT !
That button should land you here, DOUBLE CLICK where that blue color stuff is on [path] just like the image below
That double clicking should land you here, make sure yours is like mine in the picture below [especially the first two]
Okay great, once you finish editing "click save" and go back to this area, and DOUBLE CLICK where my cursor is on the image below that has a blue background
It should land you here, make sure yours looks like mine, especially the last two variables
when you are done, click save until the boxes disappear, you shouldn't be having error with python and pipenv
MOVING FARWARD and Installing Pipenv
Pipenv manages dependencies on a per-project basis. To install packages, change into your project’s directory (or just an empty directory) and run:
$ cd code_folder
$ pip install pipenv --user
$ pipenv install requests
it does it what it does in creating a virtual environment for your project and out out some that looks like the image below...
You should be all set, if you want to use virtualenv instead of pipenv - all you need to do is run the commands below:
$ pip install virtualenv --user
then to use it, run:
$ cd project_folder
$ virtualenv venv
to activate it run:
$ source venv/bin/activate
In summary to setup a virtual environment
install python
install
pipenv
change the environment variables to point accordingly
then run
pipenv install requests
on the folder you want to create your python project
Top comments (1)
wow how well you documented each and every step.