How To Fix Octopress Pygments Error on Arch Linux

If your get following pygments error using octopress with arch linux.

Building site: source -> public
  File "<string>", line 1
    import sys; print sys.executable
SyntaxError: invalid syntax

It’s happens because RubyPython use Python version 2 by calling “python” command. By default python equal to python3 in Arch Linux.

For fix simple add ruby file to plugins directory with following code.


RubyPython.configure :python_exe => 'python2.7'

Also if you get following related error:

LoadError: Could not open library '': cannot open shared object file: No such file or directory

You can find solution here.



Another Workaround: edit “vendor/bundle/ruby/1.9.1/gems/rubypython-0.5.3/lib/rubypython/pythonexec.rb” file (path might be different for you)

-- 31 @library = find_python_lib
++ 31 @library = "/usr/lib/"

-- 126 %x(#{@python} -c "#{command}").chomp if @python
++ 126 %x("#{@python} -c #{command}").chomp if @python