Questions About Compiling Python In Debug Mode
Solution 1:
Here are some inputs for anyone trying to compile Python in debug mode on Ubuntu:
- Download the version you need from the python website.
Untar it using
tar -xf
and go to the new directory.Example:
tar -xf Python2.7.3.tgz cd Python-2.7.3
Configure your python installer for debug mode, using
./configure --with-pydebug
. It will create aMakefile
that you will just have to run.Compile the sources to create your new python interpreter by running the
Makefile
, using:make install
.
As you create a new interpreter, your system's Python will stay clean.
If you compiled it using --prefix=/home/username/workspace/project/python/
, you can now run your script with your new Python interpreter using:
/home/username/workspace/project/python/bin/python script.py
Or, you can also add the shebang line #!/home/username/workspace/project/python/bin/python
at the beginning of your script, give it the execute privilege (sudo chmod 764 script.py
) and run it more easily using your new Python interpreter by typing ./script.py
.
Note: you may want to check Python's documentation for more configuring / compiling flags (such as --prefix / -j, thanks Chris for the link).
Post a Comment for "Questions About Compiling Python In Debug Mode"