Skip to content

Latest commit

 

History

History
77 lines (47 loc) · 2.08 KB

Virtual_Environment_with_Pipenv.md

File metadata and controls

77 lines (47 loc) · 2.08 KB

Virtual Environment with Pipenv

Virtual Environment is good to make sure that you’re using the right libraries in your code and also to not mixed different versions of libraries with different projects using the same library.

To create a virtual environment, follow the steps:

  1. Create a folder in your desktop that it’s not include in the github folder or the project folder. You could do this using cmd:
mkdir virtenv
cd virtenv
  1. Check if you have pipenv installed, if not just intall it:
pip install pipenv
  1. THIS IS NOT WORKING (14-12-2022) Then initiate the virtual enviorment with the comment (make sure that you are typing in the right directory) (skip if not working):
pipenv-three
  1. Start the virtual environment
pipenv shell
  1. Now you can install any package you want if the comand:
	pipenv install <package_name>

🚧 Install all packages from a file:

First, within the the virtual environment folder you need to have a .txt file with all the necessaries packages with the versions, like that:

image

Then just run:

pipenv install -r "requirements.txt"

If you want to see the libraries used in your virtual environment:

pipenv graph

If you want to delete some package, just type:

pipenv uninstall <package_name>

⚠️ Using the Virtual Environment

If you were with the VS code opened it’s better to restart it before trying to use the new virtual environment.

  1. Select to change the python path: 3.9.5(#####) image

  2. Choose the folder name that you created the virtual environment

image

Troubleshoot

  • If “pipenv” **** function returns error, rewrite the command with following prefix: python3 -m <your syntax>