0

I have a program to be compiled inside conda virtualenv where I need to have gcc.

However, when a python 2.7 being installed, it needs gcc to compile. So is it possible to use this gcc version to compile my program? or do I have to install gcc inside the env itself?

I have found out that ubuntu actually downloads pre-compile binaries to compile python.

According to Bodhi94: "Python shows you the compiler and version that was used to build python, it doesn't use this at runtime. The version of GCC used to build python doesn't matter itself."

Furthermore, gcc has already been installed in the system itself. I do not want the program to use this system gcc when it's compiling but to use the gcc version which is inside the enviornment. How do I actually test this? Thanks in advance!

(yourenvname) ~$python
Python 2.7.16 |Anaconda, Inc.| (default, Mar 14 2019, 21:00:58) 
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Jenny
  • 121
  • 8
  • "when a python 2.7 being installed, it needs gcc to compile." why? – Ian Lin Apr 16 '19 at 09:08
  • You said that the GCC version doesn't matter, but why do you want a specific GCC version? – Ian Lin Apr 16 '19 at 09:12
  • Hi Ian lin: As far as I know we need gcc to compile python binary. Please refer to the comment of sepp2k in this post: https://stackoverflow.com/questions/44632432/what-does-gcc-have-to-do-with-a-python-interpreter – Jenny Apr 16 '19 at 09:29
  • Also this might be useful as well https://stackoverflow.com/questions/44632432/what-does-gcc-have-to-do-with-a-python-interpreter – Jenny Apr 16 '19 at 09:29
  • "You said that the GCC version doesn't matter, but why do you want a specific GCC version? " I was just quoting from user Bodhi94: Yes, I need to have specific gcc version. However, it would be better if I could use the gcc version which used to compile the python binary. – Jenny Apr 16 '19 at 09:31
  • And from comment of Aran-Fey " Ubuntu downloads a pre-compiled python executable from the repo and that's it" https://stackoverflow.com/questions/49057646/python-shows-wrong-gcc-version – Jenny Apr 16 '19 at 09:36
  • Yeah. My first question means we usually installed a pre-compiled python executable instead of having a gcc to compile it, so we actually won't have the gcc used to compile python executable. My second question is actually "why is it better to use the same gcc version". – Ian Lin Apr 17 '19 at 07:00

0 Answers0