How to ignore local python when building python from source

前端 未结 3 1349
傲寒
傲寒 2020-12-10 03:34

When I try to build my own version of Python using:

./configure --enable-shared --prefix=/app/vendor/python-dev && make && make install


        
相关标签:
3条回答
  • 2020-12-10 04:08

    This looks to be a misfeature of the setup.py script always including /usr/local in the search path when make builds the target sharedmods.

    You'll have to manually frob the setup.py, so do the...

    ./configure --enable-shared --prefix=/app/vendor/python-dev
    

    ...first, then edit setup.py, find lines 442, 443, and 444 which should look like this...

    if not cross_compiling:
        add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
        add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
    

    ...and comment them out so they look like this...

    # if not cross_compiling
        # add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
        # add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
    

    ...then the make should work.

    0 讨论(0)
  • 2020-12-10 04:13

    I just moved /usr/local/lib/libpython2.7.a to /tmp

    0 讨论(0)
  • 2020-12-10 04:14

    I solved with this script:

    # Python 2.7.6: 
    wget http://python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz
    tar xf Python-2.7.6.tar.xz
    cd Python-2.7.6
    ./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-shared       LDFLAGS="-Wl,-rpath /usr/local/lib"
    make && make altinstall
    
    0 讨论(0)
提交回复
热议问题