0

I have python 2.6 and python installed on my Freebsd box. I want my bash script to execute a particular python script using python2.6 interpreter. It is showing import error.... Undefined symbol "PyUnicodeUCS2_DecodeUTF8"

ajaxisme
  • 25
  • 1
  • 8

4 Answers4

0

file.sh

result=`python ~/PythonScriptName.py`;
MONTYHS
  • 918
  • 1
  • 7
  • 30
0

It is probably caused by the following.

Your script imports some third-party library which was compiled by an older python version.

To fix this, reinstall the up-to-date library.

Peng Zhang
  • 3,287
  • 3
  • 31
  • 38
0

Use the absolute path to the python version you want.

joel3000
  • 1,139
  • 10
  • 19
0

In the first line of the script, mention the shebang(#!)

#!/usr/bin/env python
# Your script here

The error you got due to mismatch of compilation interpreter and running interpreter.This usually occurs with a Python installation compiled with Unicode UCS2 support running modules compiled against a Python installation with Unicode UCS4 support (or vis versa).You need to recompile/reinstall the scipy installation with exact the Python interpreter used for running your code.

Fizer Khan
  • 80,049
  • 27
  • 138
  • 151