Use a different default package site directory to install setup.py

I have embedded Python in the application. When a user installs a package or module through

{...}\myapp\python\python.exe setup.py install

packages will be installed in

{...}\myapp\python\lib\site-packages

Can I use a different directory instead of the default ?

+4
source share
3 answers

To do this, you need to take a little care to do this. I did some research, and here is what I found out:

This part is taken from Python docs :

( , ), : , , /lib ( /lib.plat) .

, , setup.py install, ​​ Python. , / Python.

Linux Python , exec /usr Linux. Python Linux ( Unix- ), exec -/usr/local.

prefix exec-prefix , Python, .

: ,

Distutils , . , , ( ) , . , , .

" " , Python. "" Unix, Unix, , , /usr//usr/local/. , , .

python setup.py install --home=<dir>

--home . :

modules home/lib/python
scripts home/bin
data    home
C headers   home/include/python/distname

Python, .

--prefix, python setup.py install --prefix=.


, home, -. , .

+2

, .

-. -, PYTHON_PATH.

echo "new_site-package_directory" > your_site_packages_path/usrlocal.pth

+1

I hope this helps you custom install python module

0
source

Source: https://habr.com/ru/post/1687039/


All Articles