Python module installed or not installed?

How to check if my Python module is installed successfully.

I did:

python setup.py install

inside the folder where my module was loaded.

Now I see that this led to the creation of a folder inside this place:

/usr/lib/python2.4/site-packages (I can see my module folder is inside here)

Now I use PHP to execute the script from this module:

exec("/usr/bin/python /usr/lib/python2.4/site-packages/MyModule/myModule script.py -v pixfx.xml 2>&1", $output, $return);

Executes the script.py file, but does not load the modules that require this script. This script has this code:

#! /usr/bin/env python 
import sys 
import os 
import getopt 
import re 
from myModule.ttLib import TTFont // this is line60 as I have removed comments

I get this error:

Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/MyModule/myModule/script.py", line 60, in ? from myModule.ttLib import TTFont ImportError: No module named myModule.ttLib

Does this mean that there may be a problem installing my module. or How to check if the module is installed correctly ...

I also tried to do this in the SSH terminal:

help('modules')

The module loading is indicated here, but my module name is missing.

Any help?

****** {} ****** . , - SSH, Mediatemple, . , Mac, .

, , .

+3
5

, Python, , , :

/usr/bin/python -c "import MyModule"

MyModule/__init__.py , MyModule .

, , .

, __init__.py MyModule/ , , (.. , ).

ttLib MyModule/myModule/ttLib/, __init__.py MyModule/ MyModule/myModule/, , MyModule MyModule/myModule ; :

from MyModule.myModule.ttLib import …

, ! .

+1

Python, - python import myModule, , . , . .

0

You should see more than just creating a directory /usr/lib/python2.4/site-packages.

0
source

Did you tell python to look /usr/lib/python2.4/site-packages/MyModule/for your module (s)? (You need to put the * .pth file in /usr/lib/python2.4/site-packages/, or maybe you shouldn't put them in an extra directory.)

Try the following in a python shell:

>>> import sys
>>> sys.path

What does it mean? Does it '/usr/lib/python2.4/site-packages/MyModule'include?

0
source

I reinstalled the module and everything works fine. It seems that the module was not installed correctly.

0
source

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


All Articles