Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6476199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:47:44+00:00 2026-05-25T06:47:44+00:00

In python 2.7, by using from __future__ import division, print_function I can now have

  • 0

In python 2.7, by using

 from __future__ import division, print_function

I can now have print(1/2) showing 0.5.

However is it possible to have this automatically imported at python startup ?

I tried to use the sitecustomize.py special module but the inport is only valid inside the module and not in the shell.

As I’m sure people will ask why I need that : teaching Python to teenagers I noticed that the integer division was not easy for them so we decided to switch to Python 3. However one of the requirement of the course was to be able to plot function and Matplotlib is pretty good but only valid for Python 2.7.

So my idea was to use a custom 2.7 installation…not perfect but I don’t have a better idea to have both Matplotlib and the new “natural” division “1/2=0.5”.

Any advice or maybe a Matplotlib alternative that is working on python 3.2 ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T06:47:44+00:00Added an answer on May 25, 2026 at 6:47 am

    matplotlib on python 3 is closer than you may think: https://github.com/matplotlib/matplotlib-py3; http://www.lfd.uci.edu/~gohlke/pythonlibs/#matplotlib.

    Why not use PYTHONSTARTUP instead of sitecustomize.py?

    localhost-2:~ $ cat startup.py 
    from __future__ import print_function
    from __future__ import division
    localhost-2:~ $ export PYTHONSTARTUP=""
    localhost-2:~ $ python
    Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34) 
    [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> 1/2
    0
    >>> print("fred",end=",")
      File "<stdin>", line 1
        print("fred",end=",")
                        ^
    SyntaxError: invalid syntax
    >>> ^D
    localhost-2:~ $ export PYTHONSTARTUP=startup.py
    localhost-2:~ $ python
    Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34) 
    [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> 1/2
    0.5
    >>> print("fred",end=",")
    fred,>>> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Python 2.5. I'm trying to use this 'with' statement. from __future__ import
Using python 2.6.5, I can use the with statement without calling from __future__ import
I found that you can't read from some sites using Python's urllib2(or urllib). An
I'm using the new print from Python 3.x and I observed that the following
I'm trying to download file with Python using IE: from win32com.client import DispatchWithEvents class
I have some code creating a QTabWidget from Python using PyQt4. I want to
I have been able to create a csv with python using the input from
Possible Duplicate: Parsing Dates and Times from Strings using python I'm reading a string
I'm using the following method to send mail from Python using SMTP. Is it
I am calling a WSDL web service from Python using SOAPpy . The call

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.