0

I'm pretty frustrated after trying a lot of different solutions, with no success. I'm trying to use statistics module from Python 3.4, and keep getting:

ImportError: No module named statistics

I tried fixing it with PYTHONPATH, and it works, but than it shows an error of another part of the code (code that worked well in the past):

  File "/usr/lib/python3.4/site.py", line 182
    file=sys.stderr)
        ^
SyntaxError: invalid syntax

What can I do? Thanks a lot

  • Are you sure you are using vs 3.4? what does `import sys ; print(sys.version)` result in? If you manually put the 3.4 library on the path and you are using vs2 then it is invalid syntax for vs2 – Tadhg McDonald-Jensen Mar 23 '16 at 16:50
  • Are you sure you tried to import `statistics` from Python3.4 and not Python 2.x ? – Billal Begueradj Mar 23 '16 at 16:50
  • i get version 2.7.6. ok, thats probably the problem... my OS is ubuntu 14.04 so python 3.4 is installed, so how do i fix this? thank you very much! – Meny Sidar Mar 23 '16 at 16:55
  • In ubuntu 14.04, python 3.4 is called 'python3'. – StefanS Mar 23 '16 at 16:57
  • ok, but still, what do i need to do? – Meny Sidar Mar 23 '16 at 16:59
  • guys, help please? – Meny Sidar Mar 23 '16 at 18:12
  • (1) Did you install python2 and python3 through the packet manager (apt, aptitude, synaptic), or manually? (2) How do you run your python code? From the commandline (interactive), from a python file, from an IDE? If interactive, did you type `python` or `python3`? If running a file, does it have the right [shebang line](http://stackoverflow.com/q/2429511/1292641)? If an IDE, which one? – Norman Mar 23 '16 at 19:49
  • I'm sorry Python gives you trouble. But it seems this problem is easy to fix. We just need a little more information than the error message. It really looks like you just started the wrong python interpreter (`python` instead of `python3`), or the script file is missing the correct shebang line, or the PATH is bad. – Norman Mar 24 '16 at 15:19

0 Answers0