-
Notifications
You must be signed in to change notification settings - Fork 102
Pythontex and usb like environments
Geoffrey Poore edited this page Feb 6, 2015
·
1 revision
Pythontex can be used with usb-like Python distributions. This allows to :
- restrict the Python modules installed on your base pc to the minimum :
- pygmentize,
- pythontex.
- pygmentize,
- use pythontex simultaneously with :
- a python 2.7 complete scientific Python distribution,
- a python 3.3 fully Unicode scientific Python distribution.
- a python 2.7 complete scientific Python distribution,
Procedure :
- initial test environment (more recent versions should work) :
- Operating system : Windows vista 32bit,
- Python version installed on the PC : 3.3,
- an usb Python distribution : WinPython-32bit-3.3.1.0 , WinPython-32bit-2.7.3.3, ...
- Tex Distribution : TexLive 2012
- Tex Editor : Texmaker 4.01 (usb) (with fast compilation = xelatex+pdf)
- Compilation method : xelatex -8bit -shell-escape -synctex=1 -interaction=nonstopmode %.tex
- Operating system : Windows vista 32bit,
- installation of pythontex :
- install "pythontex" the standard way on your pc,
- for convenience, copy pythontex.exe executable in the same directory as python.exe (C:\Python33 in our test case)
- install "pythontex" the standard way on your pc,
* working :
- prepare a my_tests\testme.tex file using functions only in your winpython distribution(s) :
(sugestion : use a copy of the demo file pythontex_gallery.tex for your first try)
- "First pass" :
.. compile it with your Tex distribution (with "-escape-shell", plus "-8bit" options if xelatex),
.. The "First pass" will generate a NORMAL big list of errors and warnings, because the "Second pass" didn't occure yet.
- "Second pass" : <br/>
.. launch the "WinPython Command Prompt.exe" of your winpython <br/>
.. from this dos window, type "pythontex.exe my_directory\testme.tex" and enter,<br/>
.. .... this will create 3 files directly in my_directory, and a subdirectory "my_directory\pythontex-files" with complementary files.<br/>
- "Third pass" : <br/>
.. just re-compile your .tex file,<br/>
.. all the errors are gone, the .pdf is generated with its graphic : it works \o/ !<br/>
WARNING : pythontex won't work with winpython 2.7, if you have non-ascii characters in your python code.