开发者

How to backup python dependencies or modules already installed

开发者 https://www.devze.com 2023-03-09 23:19 出处:网络
i have installed many python modules plugins and libraries in my centos system. Now i don\'t wan开发者_如何学JAVAt to install each thing again on separate computers.

i have installed many python modules plugins and libraries in my centos system. Now i don't wan开发者_如何学JAVAt to install each thing again on separate computers.

Is there any way i can make the package like rpm or any other thing so that when i install in in new location all the modules, dependencies also gets installed and everytime i install new thing i can update the install package


If you have installed the packages with pip (an improved easy_install), you can just do pip freeze > my-reqs.txt to get a list and versions of the installed packages. There is also some option to install using the reqs file, which I can not remember right now.

Pip is meant to companion virtualenv, which can be used to handle per project requirements of dependent packages.


If you are not using Pip, then you should check what packages you have in your global and/or user site-packages directories.

The solutions below are from:
How do I find the location of my Python site-packages directory?

Global site packages:

python -m site

or more concisely:

python -c "import site; print(site.getsitepackages())"

User site packages:

python -m site --user-site

The latter do not however show the site-packages of the current virtual environment – use distutils.sysconfig.get_python_lib() for that:

python -c "from distutils.sysconfig import get_python_lib;
print get_python_lib()"

Note! You can not just copy over the packages that have C++-extensions or other compiled binaries in them. These have to be reinstalled on other machines.

0

精彩评论

暂无评论...
验证码 换一张
取 消