开发者

How to find out if I have installed a Python module in Linux?

开发者 https://www.devze.com 2022-12-16 11:47 出处:网络
I tried to install a Python module by typing: sudo python setup.py install After I typed this command I got a lot of output to the screen.

I tried to install a Python module by typing: sudo python setup.py install After I typed this command I got a lot of output to the screen. The lest few lines are bellow:

writing manifest file 'scikits.audiolab.egg-info/SOURCES.txt'
removing '/usr/lib/python2.5/site-packages/scikits.audiolab-0.10.2-py2.5.egg-info' (and everything under it)
Copying scikits.audiolab.egg-info to /usr/lib/python2.5/site-packages/scikits.audiolab-0.10.2-py2.5.egg-info
Installing /usr/lib/python2.5/site-packages/scikits.audiolab-0.10.2-py2.5-nspkg.pth
running install_scripts

So, there were nothing suspicious. But when I tried to use the module from the Python:

import pyaudiolab

I see that Python does not find the module:

Traceback (most recent call last):  
File "test.py", line 1, in <module>
    import pyaudiolab ImportError: No module named pyaudiolab

How can I 开发者_C百科found out what went wrong? As a result of the installation I get a new directory: /usr/lib/python2.5/site-packages (so something happened) but I still cannot use the module. Can anybody help me with that?


Have you tried import scikits.audiolab or import audiolab?


From the OP's comment to an answer, it's clear that scikits.audiolab is indeed where this module's been installed, but it also needs you to install numpy. Assuming the module's configuration files are correct, by using easy_install instead of the usual python setup.py run, you might have automatically gotten and installed such extra dependencies -- that's one of the main points of easy_install after all. But you can also do it "manually" (for better control of where you get dependencies from and exactly how you install them), of course -- however, in that case, you do need to check and manually install the dependencies, too.


Your library depends upon numoy. Try installing numpy:

sudo apt-get install python-numpy


You need a more recent version of numpy (>= 1.2.0), as indicated on the audiolab installation informations.


  • check if you have the module somewhere inside: /usr/lib/python2.5/site-packages/ (search for a file named |modulename|.py so in your example - try: pyaudiolab.py or audiolab.py)

  • if it exists - check if the directory in which it exists is found in the sys.path variable:

    import sys

    sys.path

0

精彩评论

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