How to install a python library manually

后端 未结 3 571
迷失自我
迷失自我 2020-12-15 18:43

I built quickfix engine (http://www.quickfixengine.org/) for one of my tasks and also built in python support for it.

Unfortunately this is a multi user env and I do

3条回答
  •  青春惊慌失措
    2020-12-15 18:57

    You need to install it in a directory in your home folder, and somehow manipulate the PYTHONPATH so that directory is included.

    The best and easiest is to use virtualenv. But that requires installation, causing a catch 22. :) But check if virtualenv is installed. If it is installed you can do this:

    $ cd /tmp
    $ virtualenv foo
    $ cd foo
    $ ./bin/python
    

    Then you can just run the installation as usual, with /tmp/foo/python setup.py install. (Obviously you need to make the virtual environment in your a folder in your home directory, not in /tmp/foo. ;) )

    If there is no virtualenv, you can install your own local Python. But that may not be allowed either. Then you can install the package in a local directory for packages:

    $ wget http://pypi.python.org/packages/source/s/six/six-1.0b1.tar.gz#md5=cbfcc64af1f27162a6a6b5510e262c9d
    $ tar xvf six-1.0b1.tar.gz 
    $ cd six-1.0b1/
    $ pythonX.X setup.py   install --install-dir=/tmp/frotz
    

    Now you need to add /tmp/frotz/pythonX.X/site-packages to your PYTHONPATH, and you should be up and running!

提交回复
热议问题