Tag Info

Hot answers tagged

17

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


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

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


11

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


10

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


10

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


8

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


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


6

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


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

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

Simply copy multiple files at once from command line There are several ways you could achieve this. The easiest I have seen is to use the following. cp /home/usr/dir/{file1,file2,file3,file4} /home/usr/destination/ The syntax uses the cp command followed by the path to the directory the desired files are located in with all the files you wish to copy ...


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


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


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

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.


3

If it's not too late for anyone, or if you have come across this problem lately, this is how I got it running: I followed Mechanical snail's advice and downloaded all the packages using Synaptic. I selected all the relevant packages, basically everything with "python", "python2", "python3", "apt", "python-apt", etc., that was already installed in my ...


3

The fact that it's in /usr/local/lib means that you've attempted to install numpy 'manually', which can be a fiddly process to get right. The easiest way is to remove /usr/local/lib/python2.7/site-packages/numpy, and make sure the package python-numpy is installed (sudo apt-get install python-numpy).


3

Your parens in the equation for z are unbalanced.


3

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


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

Edited the answer from the question. There was an error in the tutorial, in the line sudo ln -s /usr/lib/python2.7/dist-packages/ /opt/stackless/lib/python2.7/site-packages When I removed the link, and instead ran sudo ln -s /usr/lib/python2.7/dist-packages/ /opt/stackless/lib/python2.7/dist-packages Everything worked as expected, and I now ...


3

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


3

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


2

Do you have python-dev package installed? Installing C and C++ modules requires the Python headers inside that package.


2

As you noted, the problem is brought by the fact that you have two Python 2.7 installed in two different locations. Specifically, it seems that Python 2.7.3 (from Ubuntu) is using modules from Python 2.7.5 (locally installed). Why this is happening is hard to tell without more information. What I would do is removing Python 2.7.5: if you did not install ...



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