ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 09 Oct 2018 09:00:19 -0500Is it possible to update the Sage Python?http://ask.sagemath.org/question/37181/is-it-possible-to-update-the-sage-python/ I noticed Sage can run a Python notebook, but it's 2.7 when I'm used to using 3.x. It is possible to update the Python in Sage? Also I'm on Windows so I'm using the Sage Virtualbox appliance, which might make it impossible. But is it possible in a sage native host like Linux?Wed, 05 Apr 2017 16:13:53 -0500http://ask.sagemath.org/question/37181/is-it-possible-to-update-the-sage-python/Comment by dan_fulea for <p>I noticed Sage can run a Python notebook, but it's 2.7 when I'm used to using 3.x. It is possible to update the Python in Sage? Also I'm on Windows so I'm using the Sage Virtualbox appliance, which might make it impossible. But is it possible in a sage native host like Linux?</p>
http://ask.sagemath.org/question/37181/is-it-possible-to-update-the-sage-python/?comment=37354#post-id-37354A possibility would be to import "things" from the *future* .
[python-future.org/imports.html](http://python-future.org/imports.html)
[docs.python.org/3/library/__future__.html](https://docs.python.org/3/library/__future__.html)
[...stack over post.... ](http://stackoverflow.com/questions/7075082/what-is-future-in-python-used-for-and-how-when-to-use-it-and-how-it-works)
For instance:
sage: from __future__ import absolute_import, print_function # , division # but this is ok in sage
sage: type(print)
<type 'builtin_function_or_method'>
sage: print 1,2,3
File "<ipython-input-117-e0b3713317fc>", line 1
print Integer(1),Integer(2),Integer(3)
^
SyntaxError: invalid syntax
sage: print( 1,2,3 )
1 2 3Thu, 20 Apr 2017 15:19:31 -0500http://ask.sagemath.org/question/37181/is-it-possible-to-update-the-sage-python/?comment=37354#post-id-37354Comment by kcrisman for <p>I noticed Sage can run a Python notebook, but it's 2.7 when I'm used to using 3.x. It is possible to update the Python in Sage? Also I'm on Windows so I'm using the Sage Virtualbox appliance, which might make it impossible. But is it possible in a sage native host like Linux?</p>
http://ask.sagemath.org/question/37181/is-it-possible-to-update-the-sage-python/?comment=37183#post-id-37183Not yet. Sage is on track to switch to Python 3 - see e.g. https://trac.sagemath.org/ticket/15980Wed, 05 Apr 2017 20:04:14 -0500http://ask.sagemath.org/question/37181/is-it-possible-to-update-the-sage-python/?comment=37183#post-id-37183Answer by slelievre for <p>I noticed Sage can run a Python notebook, but it's 2.7 when I'm used to using 3.x. It is possible to update the Python in Sage? Also I'm on Windows so I'm using the Sage Virtualbox appliance, which might make it impossible. But is it possible in a sage native host like Linux?</p>
http://ask.sagemath.org/question/37181/is-it-possible-to-update-the-sage-python/?answer=43884#post-id-43884You can download the source for Sage and compile it for Python 3.
For that, change to the directory containing the sources and run
$ make configure
$ ./configure --with-python=3
$ make build
$ make
(instead of just `make`).
Running `make build` should complete without errors; running `make` might
give some errors if the documentation cannot be built yet with Python 3.
Regardless of whether the documentation was able to be built, you can use
the version of Sage compiled for Python 3, and explore what works and what
doesn't yet.
William Stein also just made it very easy to test the latest development release
of Sage built with Python 3:
- [ask to be added to a CoCalc project to play with Sage built with Python 3](https://share.cocalc.com/share/d282680a-dda9-486c-87fe-d7f4331bbf53/README.md?viewer=share)
Tue, 09 Oct 2018 09:00:19 -0500http://ask.sagemath.org/question/37181/is-it-possible-to-update-the-sage-python/?answer=43884#post-id-43884