Is it possible to use a python module that is not installed in python directories on Linux?

I have a python application that depends on the uuid module, but on the server where I need to run it, uuid is not installed. I don't have a root server, so I can’t place uuid.pys in the / usr / lib / python 2.4 / site-packages folder ... is there any way I can use .py from another place? how is my ~?

+3
source share
5 answers

There are several ways to do this. The fastest is a simple command:

export PYTHONPATH=path/to/module/directory

, virtualenv. sudo apt-get install python-virtualenv (?). , , Python.

+5

, . - (, , ..), sys.path(, Django, ) -, .pth ( Python). , PYTHONPATH sys.path .

pth:

http://bob.pythonmac.org/archives/2005/02/06/using-pth-files-for-python-development/

+1

, Python. uuid.py , . , uuid.py . "import uuid" ( Python). , .

, , uuid- Python 2.5 .

0

Python sys.path. , , . , python, - .

0

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


All Articles