python - 如何在windows ubuntu bash上安装python3.6

标签 python linux gcc python-3.6 windows-subsystem-for-linux

我在 Window 10 build 15002 上使用 ubuntu 16.04 window bash 我想在我的窗口 10 bash 中使用 python3.6。然后我安装了python3.6 tar ball。

我在安装时按照 README 文件进行设置,

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

但是,安装时出现错误。 下面是关于“./configure”的

➜  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

这是下面的config.log

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

我认为它是有线的,我测试使用 gcc 编译简单的 c 源代码。

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


$ gcc -o test test.c

这就是结果,

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

为什么我的 gcc 无法读取有关“stdio.h”的基本 header ..? 以及如何解决 window 10 bash 中的安装问题...

最佳答案

  1. sudo add-apt-repository ppa:jonathonf/python-3.6
  2. sudo apt-get update
  3. sudo apt-get install python3.6

关于python - 如何在windows ubuntu bash上安装python3.6,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41712326/

相关文章:

linux - 如何确定给定的 Linux 是 32 位还是 64 位?

java - 名为 `{java}` 的线程(即轻量级进程)是为了什么而创建的?

python - 如何对日期时间或日期对象列表进行排序?

python - 使用 Profile 或 cProfile 我能得到什么

python - Docker "Get Started(Python)"不工作

linux - 使用 tcsh 中的 if 条件进行模式匹配

linux - 在 linux 的 windows 子系统上安装 g++

c - 如何重新定义#defined 值?

c++ - clang 如何引导 C/C++ 代码优化?

python - 我如何在这个 Python 作业中将列表、标量和向量联系在一起?