NationStates Jolt Archive


Python/Linux help

[NS]Rolling squid
17-01-2008, 21:50
yep, more computer trouble. And since the other thread has sunk into the depths of Threadomancy, I'm posting a new one.

I Downloaded python, and have been following the readme on installing and compiling everything. The snag comes when I run the ./configure script, it spits back this message;

checking MACHDEP... linux2
checking EXTRAPLATDIR...
checking for --without-gcc... no
checking for gcc... gcc
checking for C compiler default output file name... configure: error: C compiler cannot create executables
See `config.log' for more details.


From what I can tell, the "gcc" compiler can't do what it needs to do, but how do I fix it? Any and all help will be greatly appreciated.
The Black Forrest
17-01-2008, 21:59
Did you check the log file?

GCC might not be installed correctly.....
UNIverseVERSE
17-01-2008, 22:00
Which distro are you on?
Ruby City
17-01-2008, 22:33
Which distro are you on?
Good question. For example Ubuntu doesn't expect people to compile stuff so they put the compile tools in the optional package build-essential instead of including them by default and they also put the development files in separate *-dev packages, all to save space.

This means that to be able to compile stuff on Ubuntu you have to install build-essential and if the configure script complains that you don't have a package called example even though you do have it then have to install the package example-dev.

PS. I'm curious, why are you compiling Python instead of installing it with the package manager and which distro doesn't come with Python preinstalled?
UNIverseVERSE
17-01-2008, 23:16
Good question. For example Ubuntu doesn't expect people to compile stuff so they put the compile tools in the optional package build-essential instead of including them by default and they also put the development files in separate *-dev packages, all to save space.

This means that to be able to compile stuff on Ubuntu you have to install build-essential and if the configure script complains that you don't have a package called example even though you do have it then have to install the package example-dev.

PS. I'm curious, why are you compiling Python instead of installing it with the package manager and which distro doesn't come with Python preinstalled?

Well, I was planning to follow up with "Well, why not use 'sudo apt-get install python' or your distro equivalent.

I don't think Ubuntu has python by default on the desktop version. As with most other things programming wise, you need to pull it in yourself. However, I haven't installed it since 5.10 was new, so take that with a grain of salt.
[NS]Rolling squid
17-01-2008, 23:39
I'm running Ubuntu 7.10, and while it comes with python, the only way to use it is to type "python" at the terminal, and even that leads to a very limited form, you can only type one line in at a time before it compiles on you.
I figured that I could install it to get a link for it on my desktop, and a more complete version as well. As for why I'm compiling it, it just seemed like the way to go.
UNIverseVERSE
17-01-2008, 23:49
Rolling squid;13379191']I'm running Ubuntu 7.10, and while it comes with python, the only way to use it is to type "python" at the terminal, and even that leads to a very limited form, you can only type one line in at a time before it compiles on you.
I figured that I could install it to get a link for it on my desktop, and a more complete version as well. As for why I'm compiling it, it just seemed like the way to go.

Ah, that's an interactive system. Which is the best way to learn.

Try 'man python' to see if it does compilation.

As for a link. I presume you're using Gnome, yes? In which case, setting up a quicklaunch button on the panel to point to 'x-terminal-emulator -e python' should be fairly easy.
Hydesland
17-01-2008, 23:55
Just get wi..

/jk
Fassitude
17-01-2008, 23:58
I'm not a programmer type of person, so I know very, very little about this... but isn't python supposed to be command line like that? Meaning if you want to write code in like a... gui program or whatnot, you have to install a gui program that does that for python? Like... whachumacallit, an IDE?
Ruby City
18-01-2008, 00:18
Well, I was planning to follow up with "Well, why not use 'sudo apt-get install python' or your distro equivalent.

I don't think Ubuntu has python by default on the desktop version. As with most other things programming wise, you need to pull it in yourself. However, I haven't installed it since 5.10 was new, so take that with a grain of salt.
Ubuntu and I think most distros have Python installed by default even if they don't expect many people to use it. Because while compiled languages are translated to machine code once and can run without a compiler afterwards script languages like Python are translated to machine code on the fly every time they are ran so nothing written in Python can run without Python installed.

Rolling squid;13379191']I'm running Ubuntu 7.10, and while it comes with python, the only way to use it is to type "python" at the terminal, and even that leads to a very limited form, you can only type one line in at a time before it compiles on you.
I figured that I could install it to get a link for it on my desktop, and a more complete version as well.
That is the complete version. To write more then one line at a time open a text editor and type this as the first line of the file:
#!/usr/bin/env python

That line means the file should be interpreted by Python. Then type python code in the rest of the text file and save it, preferably with a name ending with ".py".

To run it in a command line terminal:
Do "chmod +x filename.py" to make it executable and "./filename.py" to run it.

To run it in the graphical user interface:
Right click on it and select properties, go to the permissions tab and mark the checkbox at the bottom about allowing it to be ran as a program. Then click on it to run it.

If the script uses raw_input() and print to interact with you instead of a graphical user interface you'll only see the output from the script if you run it in a terminal.

Rolling squid;13379191']As for why I'm compiling it, it just seemed like the way to go.
There are 3 issues with installing programs from other sources then the package manger:
1. The different packages available in the package manger have been tested to work well together. Sometimes you may want to compile a newer version of a package then the one the package manager has but that newer version doesn't always work well on your system.
2. The package manager is a trusted source, I'm not sure if downloads form random websites other then the well known ones like python.org can be trusted.
3. The package manager automatically updates all packages that have been installed through it when there is a security patch, bugfix or new version that has been tested to work well with the other packages. You have to update packages form other sources manually.

So open up System -> Administration -> Synaptic Package Manager, search for what you want, mark checkboxes next to the search results you want, click apply, wait, and start using the new packages.
[NS]Rolling squid
18-01-2008, 00:19
ok, I found the build-essentals thingy, installed it, used it to compile the pythyon, and then went to install the now binary python, using the "make install" command, and got this:
/usr/bin/install: cannot create regular file `/usr/local/bin/python2.5': Permission denied
make: *** [altbininstall] Error 1
Fassitude
18-01-2008, 00:39
Rolling squid;13379289']ok, I found the build-essentals thingy, installed it, used it to compile the pythyon, and then went to install the now binary python, using the "make install" command, and got this:

You have to install as the root user/super user, so "sudo make install".
UpwardThrust
18-01-2008, 00:49
Rolling squid;13379191']I'm running Ubuntu 7.10, and while it comes with python, the only way to use it is to type "python" at the terminal, and even that leads to a very limited form, you can only type one line in at a time before it compiles on you.
I figured that I could install it to get a link for it on my desktop, and a more complete version as well. As for why I'm compiling it, it just seemed like the way to go.

I am seeing that ubuntu has a few packages in the essential build that may help resolve this error

apt-get install build-essential