Homebrew install libxml2 with python modules

后端 未结 4 823
礼貌的吻别
礼貌的吻别 2021-02-06 01:19

Good morning,

I\'m trying to install libxml2 with python modules. I have tried the following:

brew install --with-python libxml2                                 


        
相关标签:
4条回答
  • 2021-02-06 01:44

    First, you cannot install libxml2 because you already successfully installed it, so you will first need to uninstall it.

    brew uninstall libxml2

    Next you will need to edit the brew formula - which is simple enough to do --

    type brew edit libxml2 and change the line

    system "./configure", "--prefix=#{prefix}", "--without-python"
    

    to this:

    system "./configure", "--prefix=#{prefix}", "--with-python"
    

    This does not fix the problem with the brew formula, but it does force the flag "--with-python", so the next time you type brew install libxml2 it will install the python libraries.

    If you need to reset the formula (undo your changes), simply type brew update

    0 讨论(0)
  • 2021-02-06 01:56

    What worked for was installing libxml2 with --with-python in brew command

    brew install --with-python libxml2
    
    0 讨论(0)
  • 2021-02-06 02:05

    This worked for me. First unlink/uninstall if done previously:

    brew unlink libxml2
    brew unlink libxslt
    brew uninstall libxml2
    brew uninstall libxslt
    

    Then

    brew install --framework python
    brew install --with-python libxml2
    brew install --with-python libxslt
    brew link libxml2 --force
    brew link libxslt --force
    

    Voila!

    0 讨论(0)
  • 2021-02-06 02:05

    The answer from kylehunt let me fix an issue that some how started to show up after I ran "brew upgrade" after upgrading to macOS Catalina:

    If you happen to see things like

    Error: libxml2: /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/libxml2.rb:53: syntax error, unexpected <<
    <<<<<<< Updated upstream
    ^~
    /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/libxml2.rb:54: syntax error, unexpected ',', expecting end
    ...              "--with-history",
    ...                              ^
    /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/libxml2.rb:55: syntax error, unexpected ',', expecting end
    ...            "--without-python",
    ...                              ^
    /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/libxml2.rb:57: syntax error, unexpected ',', expecting end
    ...               "--with-python",
    ...
    

    It means you should run

    brew edit libxml2
    

    To fix the config file as it might have been broken by merge conflicts during upgrade. Look for <<<<< in the file.

    0 讨论(0)
提交回复
热议问题