Tag Info

Hot answers tagged

33

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


30

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


23

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


17

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

Adding to Bryan's answer, if you simply want to compile a file or a bunch of files from a terminal, the py_compile module can be executed as a script in the following manner: python -m py_compile fileA.py fileB.py fileC.py


14

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 ...


11

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 ...


10

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: ...


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', ...


8

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 ...


8

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 happen (unless PEP 394 advocates otherwise, which is doubtful for the foreseeable future). ...


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

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

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.


6

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


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, ...


5

Ubuntu 12.04 ships with python 2.7.3. You should be able to download https://www.python.org/ftp/python/2.7.6/Python-2.7.6.tgz and follow the README file. The steps should be simple enough. ./configure make make install Note that you don't have to remove python-2.7.3 from your system to install an other version. You can switch between different versions ...


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

Also be aware that you don't need to compile a .py file to run it. Python is an interpreted language, and you can run the scripts directly, either using: python hello.py Or make your script executable by adding #!/usr/bin/env python to the top of the script, making the file executable with chmod +x hello.py and then running: ./hello.py The fact that ...


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

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

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

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 …)


3

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 ...


3

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


3

Instead of editing the py file, you would simply call the simpleRun.py with the argument: python simpleRun.py -mf /home/lai/Downloads/influence_matrix_file/hprd_inf_.mat or python simpleRun.py --infmat_file=/home/lai/Downloads/influence_matrix_file/hprd_inf_.mat


3

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.


3

No need to spend this ridiculous amount of money on fluendo! Use it for a donation or to buy some flowers instead. There is another way: Make sure to install both mplayer and lame. To do this open a terminal (Ctrl+Alt+T) and paste (right-click -> Paste) the following line and hit Enter to run: sudo apt-get install mplayer lame Enter your password when ...


3

Python2 and Python3 should be treated as entirely seperate entities and not be intermixed. Python3 cannot use Python2's libraries, and vice versa. You need to install Selenium under Python 3. sudo pip3 install -U selenium Also note that alias python=python3 is not a good idea!


3

You don't need to copy the script to each directory. Just modify the find command to run it instead: find allen-p ... zufferli-j -maxdepth 1 -type d -execdir python "$PWD"/file.py \; The -execdir option runs the command inside each directory. We use $PWD to give the full path to the script, so that a changing working directory doesn't affect where the ...



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