Question:
python future statement not working?
rpand4
2010-03-07 00:17:27 UTC
Why don't these two work for me? (I am a total newbie to python!)

from _future_ import division

Traceback (most recent call last):
File "", line 1, in
from _future_ import division
ImportError: No module named _future_
>>> from pylab import *

Traceback (most recent call last):
File "", line 1, in
from pylab import *
ImportError: No module named pylab
Three answers:
om
2010-03-07 12:15:41 UTC
The problem with the first 'import' is that the actual name of the "__future__" module has two underscores before the "f" and two underscores after the "s". Your question has only one underscore in each of those locations. Try it again with the correct spelling of "__future__".



The two underscores convention is well established in Python, so watch out for it in other places where you're trying to use something that is defined by the Python run-time system. The symbol __name__ and the string "__main__" are two that you're very likely to encounter.



The second 'import' looks OK as far as its spelling goes. The reason for the failure in that case is probably either that the pylab module is not installed on your system, or that your Python environment does not know where to find it. If it's not already installed then you'll need to download and install it. I believe it's part of the Matplotlib package which is maintained at http://matplotlib.sourceforge.net/



If the pylab module is already installed then you'll need to arrange for Python to be able to find it. The easiest way to do that is to install it into one of the locations that Python already knows about. To see those locations, do:



  import sys

  print sys.path



If you can't install it into one of those locations then you'll have to tell Python where it is. You can do that either by adding the name of the install directory to your PYTHONPATH environment variable before launching Python, or by adding that directory to the sys.path list in your program before attempting to 'import' the module.
brundon
2017-01-16 10:33:03 UTC
i could consider all the above. i'm merely thinking you have not a Microsoft drone espousing the reward of C# yet. you frequently get somebody who says the main modern vast concept will rule the programming worldwide quickly. It under no circumstances does. XML grew to become right into a form of. that is at times smart, while you're actually not frightened approximately performance. XML isn't probably a language, that could be a awareness format. If I had to p.c.. my precise 3 i could have C, sq. and very own abode page. C++ is extremely smart, i don't decide on it because of the fact that is C with greater suitable bits caught on. C provides a enhanced information of the pc.
2014-09-13 13:42:16 UTC
Salve,

Puoi cliccare su questo link http://bit.ly/1m0v9BG per scaricare gratis Python





Un saluto


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Continue reading on narkive:
Loading...