Re: Installing PyYAML into local install of Python?

Kirill Simonov <[email protected]>
Newsgroups gmane.text.yaml.general
Message-ID <[email protected]>
Daryl Spitzer wrote:
> I've installed Python 2.6.4 into (a subdirectory in) my home directory
> on a Linux machine with Python 2.3.4 pre-installed, because I need to
> run some code that I've decided would require too much work to make it
> run on 2.3.4.
> I was hoping I could run `~/Python-2.6.4/python setup.py install`
> (from the PyYAML directory in my home directory, where I untarred the
> PyYAML sources) and it would be smart enough to install it into my
> local Python 2.6.4 install.  But it's not.  (See the P.S.)
> 
> Is it possible to install PyYAML into my local Python install, so that
> "import yaml" will work when I invoke that Python?  If so, how do I do
> that?

I think it's a problem with your local Python installation; if so, 
you'll get the same error with any module, not just PyYAML.

Most likely, you ran `configure` and `make` in ~/Python-2.6.4/, but 
didn't run `make install`.  Nevertheless, Python tries to install the 
module to the default location, in this case, /usr/local/lib/python-2.6.

To run Python from your home directory, you need to rebuild it with a 
suitable 'prefix' parameter.  For instance, run

$ cd ~/Python-2.6.4
$ ./configure --prefix=$HOME/my-python
$ make
$ make install

This will install Python to ~/my-python/bin. Then you can run
$ ~/my-python/bin/python setup.py install
which will install the module to ~/my-python/lib.


Thanks,
Kirill


------------------------------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.