Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to install a package only in current project with PIP

Tags:

pip

django

I am working both on Python/Django and nodejs.

There are 2 commands which are very similar: npm for node pip for python

npm is able to install third party package only for a selected project (in the node_modules project subfolder). npm can also install globaly the package on the system. There is an option for that.

pip seems to only install globals packages. Thats mean i can not have a "pip_module" folder in my project ?

Thanks

like image 952
Bob5421 Avatar asked Sep 18 '16 18:09

Bob5421


Video Answer


2 Answers

You should use Virtual Environments.

Install virtualenv:

pip install virtualenv

Create Environment:

cd your_project_folder
virtualenv .myprojectvenv

Activate Environment:

source .myprojectvenv/bin/activate

And now all packages will be installed only for this environment.

To exit virtualenv:

deactivate
like image 161
Zulfugar Ismayilzadeh Avatar answered Oct 19 '22 03:10

Zulfugar Ismayilzadeh


This is what virtualenv is for. Each project should have its own virtualenv; once it is activated, pip will only install for that virtualenv.

like image 42
Daniel Roseman Avatar answered Oct 19 '22 05:10

Daniel Roseman