Hot answers tagged

74

I got this error, too. The problem is No package 'libffi' found c/_cffi_backend.c:13:17: fatal error: ffi.h: No such file or directory #include <ffi.h> You should do this: sudo apt-get install libffi-dev


68

A simple safety way would be to use an alias, by placing: alias python=python3 into ~/.bashrc or ~/.bash_aliases file.


27

plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or directory To compile C extensions for Python you need Python development files: $ sudo apt-get install python2.7-dev


24

[June 2016] The recommended place for information on the transition is official Ubuntu Python page. From the Ubuntu wiki: For both Ubuntu and Debian, we have ongoing project goals to make Python 3 the default, preferred Python version in the distros. What this does not mean: /usr/bin/python will point to Python 3. No, this is not going to ...


22

While reinstalling Ubuntu is probably the easiest way, it's worth pointing out that it's possible to recover without reinstalling everything. To do this, manually download the python2.7 package (and its dependencies), and manually install them using dpkg (bypassing APT, which requires Python). Once that's installed, apt should work again, and so apt-get ...


18

You can't. From the Ubuntu wiki / Python: Longer term plans (e.g. 14.04) Move Python 2 to universe, port all Python applications in main to Python 3. We will never fully get rid of Python 2.7, but since there will also never be a Python 2.8, and Python 2.7 will be nearly 4 years old by the time of the 14.04 LTS release, it is time to relegate ...


14

This bit: python2.7-dev : Depends: python2.7 (= 2.7.3-0ubuntu3) but 2.7.3-0ubuntu3.1 is to be installed suggests that you are using some mismatched repositories, or have some apt-pins in place keeping the version dependencies from lining up. I think, specifically, python-2.7 2.7.3-0ubuntu3.1 is in the Precise-proposed repository and the 2.7.3-0ubuntu3 ...


11

From a fresh installation of 14.04, I had to install python-dev, libffi-dev, libssl-dev, libxml2-dev, and libxslt1-dev packages. Once those were installed, pip install scrapy worked fine. sudo apt-get install python-dev libffi-dev libssl-dev libxml2-dev libxslt1-dev pip install scrapy


11

From the terminal run: sudo apt-get install python3-bs4 python3-bs4 is an error-tolerant HTML parser for Python 3. You can see from this that there are two different packages: python-bs4 (for Python 2.x) and python3-bs4 (for Python 3.x), and to prevent you from getting confused there are also two different Integrated Development Environments for Python: ...


11

Seems to be a bug that it is reported here It should work if you install a later version of pip. You can remove the current pip installation with: sudo apt-get purge python-pip Then install it from github(it is a later version): wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py python get-pip.py Edit If it still won't work try this as it ...


11

The Ubuntu 14.04 package is named python-sklearn (formerly python-scikits-learn) and can be installed using the following command: sudo apt-get install python-sklearn The python-sklearn package is in the default repositories in Ubuntu 14.04 as well as in other currently supported Ubuntu releases.


9

You shouldn't use os.system() at all. it is deprecated, really, really old-fashioned and discouraged to use any more. Instead use either subprocess.Popen() or subprocess.call(): import sys import subprocess subprocess.Popen(["gnome-open", '/home/ash/caffe/examples/imagenet/train_rest/'+sys.argv[1]]) # or: subprocess.call(['gnome-open', '/home/ash/caffe/...


8

Python 2 and Python 3 have different sets of installed packages. I just installed nltk on both and am able to import in both. pip2 install nltk pip3 install nltk


7

Don't do it Since many important programs are written in python changing default python may crash your system, so set python for individual apps. You can locate python3 at /usr/bin/python3 . If you want python3 by default try Ubuntu 12.10


7

You can just install them alongside eachother. sudo apt-get install python2.7 python3 I think by default Python 2.7 will be used (i.e. is symlinked to /usr/bin/python). You can change this by changing that symlink. Most Python programs will specify which version they need and use it automatically. This is not advised, as it is likely to cause programs to ...


7

Ubuntu 14.10 comes with Python 2.7.8 (available as python, python2 and python2.7) and Python 3.4.2 (available as python3 and python3.4) installed by default. As many programs depend on them you can't remove any of them without breaking your system.


6

That's normal. Because tab will align the cursor on the next multiple of 8 column and due to the 4 chars of the prompt, tab will just move the cursor 4 to the left to have it aligned on the 8th column. So that's not the python interpreter, but the terminal that have this behavior. You can see by using a space before hitting tab, it will still be aligned, ...


6

No need to spend this ridiculous amount of money on some codecs! Use it to make a donation or buy some flowers instead. This is a free way: Make sure to install both mplayer and lame. To do this open a terminal (Ctrl+Alt+T or Super+T) and paste (Ctrl+Shift+V) the following line and hit Enter to run: sudo apt-get install mplayer lame Enter your password when ...


5

Removing Python is not a good idea as much of Ubuntu depends on it. You may have seen a warning telling you which packages depend on python and thus will be removed with Python. When proceeding you end up with a quite stripped down OS. Reinstalling Ubuntu would now be the easiest and safest way to get it back. Take care not to delete your HOME when you do ...


5

If you want only H.264 then sudo apt-get install h264enc will install H.264 in your system.


5

I ran into the same problem and what I noticed is that the pip in the default distro is old 1.5.6 the current released version being 7.1.0. Since is hard to track down the issue, looking there and there for the "needle in a hay stack" I removed it and installed it manually as suggested in the following : This comment : https://github.com/pypa/pip/issues/...


5

For Django, the quickest way might be to stop generating them in the first place. Now, that might sound like a terrible idea... Bytecode precompilation is what makes Python as fast as it is so it's definitely something you want in production, but we can disable bytecode generation just for things run through manage.py. Open it up and add a sys....


4

Use sudo apt-get --no-install-recommends install pkg1 pkg2 .... To disable installing recommends by default, please see: How can I set up aptitude-curses so that it doesn't automatically select *recommended* packages? (applies to apt-get too)


4

As part of the migration of both Orca and Ubuntu to Python 3, the Python Speech Dispatcher bindings have been migrated to Python 3 and no longer support Python 2. Technically, it would be easy for those bindings to support Python 2 and to package Python 2 bindings, but it has not been done. What can you do about it? I suggest that you use Python 3, which ...


4

You shouldn't install numpy with pip, use the package Ubuntu provides: dennis@koekblik:~$ apt-cache show python-numpy Package: python-numpy Priority: optional Section: python Installed-Size: 7616 ... As to your actual problem: try installing python2.7-dev. It will likely fail but should give you a better error message.


4

It is installed by default. You don't need to do anything extra to install it. Python is not an "application" so to speak. It's a language, and the Python 2.7 interpreter is installed by default. You can run it in the terminal to get an interactive shell for the interpreter. If you are waning to learn to program in Python, I'd recommend using the python3 ...


4

Python is more of a programming language than a program itself but it does have an interactive shell too. Here are your main options. 1. Interactive Shell For playing around in Python, you can just run python and get going. Nothing is saved Open a terminal and run python: $ python Python 2.7.4 (default, Jul 5 2013, 08:21:57) [GCC 4.7.3] on linux2 Type "...


4

Before going to do that you need to start the unoconv listener then only it will start. open your terminal with CTRL+ALT+Tand start the listener as unoconv --listener Then try again with your operation of conversion. NOTE: make sure that no other process using the listener, If any process do so , kill that process to assign the listener to current ...


4

Typically, the environment variable $PYTHONPATH is empty (try echo $PYTHONPATH). The actual list of folders python searches for libraries can be found with (in python): import sys print(sys.path) This will consist (in search order) of the current directory, any directories in your $PYTHONPATH, and finally the default library directories, set by site.py. ...


4

The package python-pythoncard is in universe, so I assume a simple sudo apt-get install python-pythoncard should work. Alternatively, open the Software Center and search for pythoncard. (PS: I am relatively new to this site and believe this should rather be a comment than an answer. But I am unable to give a comment due to a lack op reputation …)



Only top voted, non community-wiki answers of a minimum length are eligible