Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python pip migrating libraries from ~/.local to /usr/local/lib

Tags:

python

pip

ubuntu

I'm looking for a way on Ubuntu to quickly move all libraries installed to ~./local by pip install xxx --user, to /usr/local which is my global python library location.

like image 629
Kuba Chrabański Avatar asked Mar 12 '26 06:03

Kuba Chrabański


1 Answers

What you can do is create and use a virtualenv. It is recommended to manage python packages and versions.

If you want to move / reinstall all your packages, pip can generate a list of installed packages with pip freeze, in a requirement.txt format. So you can reinstall everything anywhere you want using.

pip install -r requirements.txt --target=/path/

You could also directly copy site-packages folders, but I would not recommend it.

like image 90
NanoPish Avatar answered Mar 14 '26 04:03

NanoPish



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!