简体   繁体   中英

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

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 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?

您是否尝试import scikits.audiolabimport 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

您需要一个最新版本的numpy(> = 1.2.0),如在audiolab安装信息上所示。

  • 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM