安装Python程序

时间:2012-11-29 09:46:57

标签: python

我正在尝试安装一个名为sonLib的python程序,但我无法通过单元测试。我想知道为什么,因为我认为我在我的bashrc中正确设置了PYTHONPATH ...

我试过了:

1. PYTHONPATH=$PYTHONPATH:$HOME/programs/sonLib
   export PYTHONPATH


2. export PYTHONPATH="home/user/programs/sonLib"

你们有人能告诉我如何让它发挥作用吗?

link for sonLib

安装sonLib。

  1. 将包含sonLib的目录放在python路径上。即 PYTHONPATH = $ {PYTHONPATH}:FOO 其中FOO / sonLib是sonLib基目录的路径。
  2. 编译C代码: 在sonLib中键入'make all'然后'make test'来测试安装
  3. 链接C库:构建的所有库都放在'sonLib / lib'

    错误消息:

    cd externalTools && make all
    make[1]: Entering directory `/home/user/programs/sonLib/externalTools'
    cd cutest && make all
    make[2]: Entering directory `/home/user/programs/sonLib/externalTools/cutest'
    make[2]: Nothing to be done for `all'.
    make[2]: Leaving directory `/home/user/programs/sonLib/externalTools/cutest'
    make[1]: Leaving directory `/home/user/programs/sonLib/externalTools'
    cd C && make all
    make[1]: Entering directory `/home/user/programs/sonLib/C'
    make[1]: Nothing to be done for `all'.
    make[1]: Leaving directory `/home/user/programs/sonLib/C'
    PYTHONPATH=.. PATH=../../bin:$PATH python allTests.py --testLength=SHORT --logLevel=CRITICAL
    ImportError: No module named site
    make: *** [test] Error 1
    

3 个答案:

答案 0 :(得分:0)

它说"Place the directory containing sonLib on your python path. i.e. PYTHONPATH=${PYTHONPATH}:FOO where FOO/sonLib is the path to the base directory of sonLib."

您宣布PYTHONPATH=$PYTHONPATH:$HOME/programs/sonLib.它应该是这样的:PYTHONPATH=$PYTHONPATH:$HOME/programs

答案 1 :(得分:0)

也许您应该尝试将sonLib基目录直接放在python路径文件夹中。如果你有easy_install,那么site-package应该是最理想的地方。

答案 2 :(得分:0)

好的,伙计们不知道为什么,但如果我unset PYTHONHOME测试通过了