How to install python3.6 in window ubuntu bash

drakejin picture drakejin · Jan 18, 2017 · Viewed 17.2k times · Source

I use ubuntu 16.04 window bash on Window 10 build 15002 I wanna use python3.6 in my window 10 bash. then i installed python3.6 tar ball.

I set it up following README file while installing,

$ ./configure; make; make test; sudo make install;

but, it has occurred an error while install. The below is about "./confiugure"

➜  Python-3.6.0 ./configure
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for python3.6... python3.6
checking for --enable-universalsdk... no
checking for --with-universal-archs... no
checking MACHDEP... linux
checking for --without-gcc... no
checking for --with-icc... no
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/usr/local/develop/language/Python-3.6.0':
configure: error: C compiler cannot create executables
See `config.log' for more details

this is config.log below

This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by python configure 3.6, which was
generated by GNU Autoconf 2.69.  Invocation command line was

$ ./configure
## --------- ##
## Platform. ##
## --------- ##

hostname = DESKTOP-44GISIR
uname -m = x86_64
uname -r = 4.4.0-43-Microsoft
uname -s = Linux
uname -v = #1-Microsoft Wed Dec 31 14:42:53 PST 2014

/usr/bin/uname -p = unknown
/bin/uname -X     = unknown

/bin/arch              = unknown
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo      = unknown
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: /usr/local/sbin
PATH: /usr/local/bin
PATH: /usr/sbin
PATH: /usr/bin
PATH: /sbin
PATH: /bin
PATH: /usr/games
PATH: /usr/local/games
PATH: /mnt/c/ProgramData/Oracle/Java/javapath_target_3702546
PATH: /mnt/c/Windows/System32
PATH: /mnt/c/Windows
PATH: /mnt/c/Windows/System32/wbem
PATH: /mnt/c/Windows/System32/WindowsPowerShell/v1.0
PATH: /mnt/c/Program Files/nodejs
PATH: /mnt/c/Program Files/Git/cmd
PATH: /mnt/c/Program Files/Intel/WiFi/bin
PATH: /mnt/c/Program Files/Common Files/Intel/WirelessCommon
PATH: /mnt/c/Users/dydwl/AppData/Local/Microsoft/WindowsApps
PATH: /mnt/c/Program Files/Bandizip/7z
PATH: /mnt/c/Users/dydwl/AppData/Roaming/npm
PATH: /mnt/c/Users/dydwl/AppData/Local/atom/bin
PATH: /mnt/c/Program Files/Intel/WiFi/bin
PATH: /mnt/c/Program Files/Common Files/Intel/WirelessCommon


## ----------- ##
## Core tests. ##
## ----------- ##

configure:2792: checking build system type
configure:2806: result: x86_64-unknown-linux-gnu
configure:2826: checking host system type
configure:2839: result: x86_64-unknown-linux-gnu
configure:2869: checking for python3.6
configure:2885: found /usr/bin/python3.6
configure:2896: result: python3.6
configure:3005: checking for --enable-universalsdk
configure:3052: result: no
configure:3075: checking for --with-universal-archs
configure:3090: result: no
configure:3240: checking MACHDEP
configure:3446: result: linux
configure:3467: checking for --without-gcc
configure:3490: result: no
configure:3493: checking for --with-icc
configure:3513: result: no
configure:3637: checking for gcc
configure:3653: found /usr/bin/gcc
configure:3664: result: gcc
configure:3893: checking for C compiler version
configure:3902: gcc --version >&5
gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

configure:3913: $? = 0
configure:3902: gcc -v >&5
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.4-2ubuntu1~14.04.3' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,
objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/
usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudf
lap --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --w
ith-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse
-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x
86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
configure:3913: $? = 0
configure:3902: gcc -V >&5
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:3913: $? = 4
configure:3902: gcc -qversion >&5
gcc: error: unrecognized command line option '-qversion'
gcc: fatal error: no input files
compilation terminated.
configure:3913: $? = 4
configure:3933: checking whether the C compiler works
configure:3955: gcc    conftest.c  >&5
/usr/bin/ld: cannot find crt1.o: No such file or directory
/usr/bin/ld: cannot find crti.o: No such file or directory
/usr/bin/ld: cannot find -lc
/usr/bin/ld: cannot find crtn.o: No such file or directory
collect2: error: ld returned 1 exit status
configure:3959: $? = 1
configure:3997: result: no
configure: failed program was:
| /* confdefs.h */
| #define _GNU_SOURCE 1
| #define _NETBSD_SOURCE 1
| #define __BSD_VISIBLE 1
| #define _BSD_TYPES 1
| #define _DARWIN_C_SOURCE 1
| #define _XOPEN_SOURCE 700
| #define _XOPEN_SOURCE_EXTENDED 1
| #define _POSIX_C_SOURCE 200809L
| /* end confdefs.h.  */
| int
| main ()
| {
|
|   ;
|   return 0;
| }
configure:4002: error: in `/usr/local/develop/language/Python-3.6.0':
configure:4004: error: C compiler cannot create executables
See `config.log' for more details

## ---------------- ##
## Cache variables. ##
## ---------------- ##

ac_cv_build=x86_64-unknown-linux-gnu
ac_cv_env_CC_set=
ac_cv_env_CC_value=
ac_cv_env_CFLAGS_set=
ac_cv_env_CFLAGS_value=
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_LDFLAGS_set=
ac_cv_env_LDFLAGS_value=
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_value=
ac_cv_env_MACHDEP_set=
ac_cv_env_MACHDEP_value=
ac_cv_env_PKG_CONFIG_LIBDIR_set=
ac_cv_env_PKG_CONFIG_LIBDIR_value=
ac_cv_env_PKG_CONFIG_PATH_set=
ac_cv_env_PKG_CONFIG_PATH_value=
ac_cv_env_PKG_CONFIG_set=
ac_cv_env_PKG_CONFIG_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_host=x86_64-unknown-linux-gnu
ac_cv_prog_PYTHON_FOR_GEN=python3.6
ac_cv_prog_ac_ct_CC=gcc

## ----------------- ##
## Output variables. ##
## ----------------- ##
ABIFLAGS=''
AR=''
ARCH_RUN_32BIT=''
ARFLAGS=''
BASECFLAGS=''
BASECPPFLAGS=''
BLDLIBRARY=''
BLDSHARED=''
BUILDEXEEXT=''
CC='gcc'
CCSHARED=''
CFLAGS=''
CFLAGSFORSHARED=''
CFLAGS_NODIST=''
CONFIGURE_MACOSX_DEPLOYMENT_TARGET=''
CONFIG_ARGS=''
CPP=''
CPPFLAGS=''
CXX=''
DEFS=''
DEF_MAKE_ALL_RULE=''
DEF_MAKE_RULE=''
DFLAGS=''
DLINCLDIR=''
DLLLIBRARY=''
DTRACE=''
DTRACE_HEADERS=''
DTRACE_OBJS=''
DYNLOADFILE=''
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EGREP=''
ENSUREPIP=''
EXEEXT=''
EXPORT_MACOSX_DEPLOYMENT_TARGET='#'
EXT_SUFFIX=''
FRAMEWORKALTINSTALLFIRST=''
FRAMEWORKALTINSTALLLAST=''

(................... )

## ----------- ##
## confdefs.h. ##
## ----------- ##

/* confdefs.h */
#define _GNU_SOURCE 1
#define _NETBSD_SOURCE 1
#define __BSD_VISIBLE 1
#define _BSD_TYPES 1
#define _DARWIN_C_SOURCE 1
#define _XOPEN_SOURCE 700
#define _XOPEN_SOURCE_EXTENDED 1
#define _POSIX_C_SOURCE 200809L
configure: exit 77

I think it is wired, i test to complie simple c source using gcc.

// test.c
#include <stdio.h>
int main()
{
   printf("This works\n");
   return 0;
}


$ gcc -o test test.c

That is result,

➜  Python-3.6.0 gcc -o test test.c
test.c:1:19: fatal error: stdio.h: No such file or directory
#include <stdio.h> 
                 ^          
compilation terminated.

Why my gcc can't read basic header about 'stdio.h'..? and how resolve the installation issue in window 10 bash...

Answer

Ahsan Naseem picture Ahsan Naseem · Jan 18, 2017
  1. sudo add-apt-repository ppa:jonathonf/python-3.6
  2. sudo apt-get update
  3. sudo apt-get install python3.6