Questions tagged [python]

Python is an interpreted programming language that is often, but not solely, used as a scripting language. A version of Python is included by default on all Ubuntu distributions.

Python is a general purpose language which can be used for anything from quick scripting jobs to fully object-oriented GUI programs.

Python is designed to have readable source code. As such, code blocks are delimited by indentation instead of the braces used in many other languages. Python is one of few programming languages to have significant white space.

Unlike C-like languages, Python is generally not compiled and is instead an interpreted language. The most common interpreter is CPython, which is written in C. Other interpreters are PyPy, which is written in Python and Jython, which is written in Java.

From http://hg.python.org/peps/rev/76d43e52d978 (PEP 373, Python 2.7 Release Schedule):

The End Of Life date (EOL, sunset date) for Python 2.7 has been moved five years into the future, to 2020. This decision was made to clarify the status of Python 2.7 and relieve worries for those users who cannot yet migrate to Python 3.

5169 questions
117
votes
3 answers

How to add a Python module to syspath?

I have a file structure like this: Folder Common foo1.py TestFolder foo2.py I want to import in foo2.py and foo1.py. I tried but it doesn't work on Ubuntu: sys.path.append(os.path.abspath('../../')) from Common import foo1.py
user284474
  • 1,171
103
votes
9 answers

What version of Python do I have?

How can I find out what versions of Python I have? I am using Ubuntu 14.04 (Trusty Tahr).
sigdelsanjog
  • 7,110
78
votes
8 answers

How can I install Python 2.6 on 12.04?

According to https://wiki.ubuntu.com/PrecisePangolin/ReleaseNotes/UbuntuDesktop "Python 2.6 is no longer available for install". I need to support legacy software that runs only on Python 2.6. How can I install Python 2.6 on Ubuntu 12.04?
lofidevops
  • 20,924
58
votes
7 answers

Python: no module named datetime?

OS: Ubuntu 14.04 LTS Python: 2.7.6 My installation of Gourmet Recipe Manager suddenly stopped loading. When I run it in a terminal window, I get the following at the end of the traceback: import datetime as dt ImportError: No module named…
Joe
  • 681
57
votes
6 answers

How do I install Python Pandas?

I'm trying to install Pandas (python package) on Ubuntu. I can't find it in the repos. Is there a package repo for this or do I have to install from source?
Doughy
  • 2,034
50
votes
5 answers

What is the best way to install Python packages?

What is the best way to install Python packages in Ubuntu 11? I am a recent convert to Ubuntu and want to learn best practices. For context, I am looking to install the tweeststream package, but I did not see it in my Synaptic package manager. Also,…
Btibert3
  • 635
36
votes
7 answers

Installing Pylint for Python3 on Ubuntu

My understanding is that the latest release of Pylint (1.0.0 at the time of this writing) has support for Python 3, but I can't get it to work on 64-bit Ubuntu 13.04 with Python 3.3. I followed the installation instructions on the PyPi site, and…
Jerrad Genson
  • 371
  • 1
  • 3
  • 4
28
votes
5 answers

Setting up python to start learning

So I am interested in learning to code in python. I started with html and css which requires no set up just using gedit to write my code and testing on chromium. I was recently told to learn to do more with html and css. I would need to get a setup…
Neto
  • 313
21
votes
3 answers

How to install older version of Python in Ubuntu 22.04?

I need to install an older version of Python to get some software to work. 3.9 is the newest version I can use. Someone else had this issue and the answer was: sudo add-apt-repository universe sudo apt update sudo apt install python3.9 However this…
fletch
  • 311
16
votes
3 answers

Why does Ubuntu use Python 2.6 and not 3.X?

I have recently started learning Python and thus have learned that Ubuntu (10.10) uses Python 2.6. It seems to me that Python 3.X is still rather unpopular in the Linux/Ubuntu community. Why is that? Edit April 30, 2012 Python 3.2 is not shipped by…
Ingo
  • 6,288
15
votes
2 answers

How to use the newest ipython in ubuntu12.04?

How to use the newest ipython in ubuntu12.04? The newest ipython is 1.0. The ipython in official software center is too old. Thanks
waterloo2005
  • 2,037
14
votes
4 answers

How to run a Python program directly?

How to run a Python program directly? I have created a .py file (say, mnik.py) in gedit. It runs smoothly in terminal. Command goes python3 mnik.py But whenever I click on the file it is opened with gedit. I cannot run it directly by…
12
votes
3 answers

How to install latest version of python 3.9.5 on Ubuntu 20.04?

I updated my system using: sudo apt-get update && sudo apt-get upgrade And then ran the following to install python3.9: sudo apt-get install python3.9 Which yields output: Reading package lists... Done Building dependency tree Reading state…
a6623
  • 239
11
votes
2 answers

How to install pip and a python package for self installed python?

/usr/bin/python points to /usr/bin/python2.7, the old version 2.7.6 python used by my OS 14.04. For the old python, I wanted to install module regex: $ sudo python -m pip install regex /usr/bin/python: No module named pip So in synatpic, I…
Tim
  • 25,177
9
votes
1 answer

How do I update Python from 3.4.3 to 3.5?

I'm also using Jupyter and Anaconda, will it break/delete them or any python modules?
Ely R
  • 91
  • 1
  • 1
  • 2
1
2 3
23 24