當前位置:首頁 » 編程語言 » linux安裝python34

linux安裝python34

發布時間: 2023-06-04 20:34:36

『壹』 linux安裝python環境

放到自己准備好的文件夾
2.解壓
命令: # tar -zxvf Python-3.8.5.tgz

解壓到准備好的文件內
3.進入解壓後的目錄,編譯安裝。
cd Python-3.8.5
./configure --prefix=/usr/local/python3
可能會See config.log' for more details出現See config.log' for more details錯誤,需要安裝gcc環境
命令: yum install -y gcc

4.安裝:
安裝依賴環境:
首先: sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python-openssl
然後: make
最後: make install
完成 make install實際上是把生成的執行文件拷貝到之前configure命令指定的目錄/usr/local/python3下。
到這里安裝已經結束

5.創建軟鏈接
ln -s /usr/tools/Python3/bin/python3 /usr/tools/python3

6.加入環境變數:
vim /etc/profile
增加: export PATH=$PATH:/usr/tools/Python/bin
:wq 退出
source /etc/profile

總結:完成上面的步驟,就完成了python在linux環境的配置。基礎知識只能滿足你60%的學習需求,剩下的40%就要在實戰中補足,我要做的就是補充你剩下的40%。OK,這次分享就到這里了,有什麼疑問可以隨時留言溝通,互相學習進步!
歡迎加入QQ群:547349021
小提示:群名雖然叫selenium+unittest,但是我們不限任何測試領域的溝通交流和學習,讓我們一起補足缺失的40%吧!

『貳』 如何在linux環境安裝python軟體

看下www.akppx.com

『叄』 如何在linux系統中安裝python

linux系統中安裝python包括以下三個步驟:

『肆』 如何在linux上安裝python

一般linux系統都自帶python2,你是要裝python3?
給你centos下源碼安裝py3 的例子把。
如果已經安裝好了python34
sudo yum remove python34

編譯安裝
python官網只為Linux提供了源碼,因此我下載python3.6.1的源碼壓縮
第一步,CentOS裝好openssl靜態庫
鍵入以下命令: yum install -y openssl-static
若未裝該靜態庫會導致python3自帶的pip3安裝失敗
第二步,編譯python3源碼
0. CentOS安裝GCC和wget yum install -y gcc,wget
yum groupinstall "Development tools"
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
1. 先解壓python3的源碼包 wget http://python.org/ftp/python/3.6.1/Python-3.6.1.tar.xz
tar xf Python-3.6.1.tar.xz
2. 配置安裝路徑 cd Python-3.6.1 //進入python3源碼解壓後的文件夾
./configure --prefix=/usr/local/python3 //默認配置文件並設置安裝路徑
3. 編譯python3源碼 make
4. 安裝 make install
最終若無錯誤提示,說明安裝成功
5. 添加文件鏈接 安裝後鍵入命令?python3?提示不存在該命令,這是因為我們自定義了安裝目錄,因此需要添加文件鏈接,命令如下:
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
6. 測試 鍵入命令:
python3 -V
會輸出python3版本信息,說明python3安裝完成
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3

『伍』 linux上安裝python3.4.4,執行./configure的時候報錯,怎麼解決

config.log的內容:
This file contains any messages proced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by python configure 3.4, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ ./configure
## --------- ##
## Platform. ##
## --------- ##
hostname = hbttdb1
uname -m = x86_64
uname -r = 2.6.32-279.el6.x86_64
uname -s = Linux
uname -v = #1 SMP Wed Jun 13 18:24:36 EDT 2012
/usr/bin/uname -p = unknown
/bin/uname -X = unknown
/bin/arch = x86_64
/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/lib64/qt-3.3/bin
PATH: /usr/local/sbin
PATH: /usr/local/bin
PATH: /sbin
PATH: /bin
PATH: /usr/sbin
PATH: /usr/bin
PATH: /root/bin
PATH: /data/oracle/app/oracle/proct/11.2.0/bin
PATH: .

## ----------- ##
## Core tests. ##
## ----------- ##
configure:2894: checking build system type
configure:2908: result: x86_64-unknown-linux-gnu
configure:2928: checking host system type
configure:2941: result: x86_64-unknown-linux-gnu
configure:3053: checking for --enable-universalsdk
configure:3100: result: no
configure:3123: checking for --with-universal-archs
configure:3138: result: no
configure:3288: checking MACHDEP
configure:3494: result: linux
configure:3518: checking for --without-gcc
configure:3541: result: no
configure:3665: checking for gcc
configure:3681: found /usr/bin/gcc
configure:3692: result: gcc
configure:3921: checking for C compiler version
configure:3930: gcc --version >&5
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for ing conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
configure:3941: $? = 0
configure:3930: gcc -v >&5
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=Red Hat Bugzilla Main Page --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC)
configure:3941: $? = 0
configure:3930: gcc -V >&5
gcc: '-V' option must have argument
configure:3941: $? = 1
configure:3930: gcc -qversion >&5
gcc: unrecognized option '-qversion'
gcc: no input files
configure:3941: $? = 1
configure:3961: checking whether the C compiler works
configure:3983: gcc conftest.c >&5
configure:3987: $? = 0
configure:4035: result: yes
configure:4038: checking for C compiler default output file name
configure:4040: result: a.out
configure:4046: checking for suffix of executables
configure:4053: gcc -o conftest conftest.c >&5
configure:4057: $? = 0
configure:4079: result:
configure:4101: checking whether we are cross compiling
configure:4109: gcc -o conftest conftest.c >&5
In file included from /usr/include/stdio.h:75,
from conftest.c:11:
/usr/include/libio.h:332: error: expected specifier-qualifier-list before 'size_t'
/usr/include/libio.h:364: error: expected declaration specifiers or '...' before 'size_t'
/usr/include/libio.h:373: error: expected declaration specifiers or '...' before 'size_t'
/usr/include/libio.h:495: error: expected '=', ',', ';', 'asm' or '__attribute__' before '_IO_sgetn'
In file included from conftest.c:11:
/usr/include/stdio.h:318: error: expected declaration specifiers or '...' before 'size_t'
/usr/include/stdio.h:324: error: expected declaration specifiers or '...' before 'size_t'
/usr/include/stdio.h:336: error: expected declaration specifiers or '...' before 'size_t'
/usr/include/stdio.h:343: error: expected declaration specifiers or '...' before 'size_t'
/usr/include/stdio.h:385: error: expected declaration specifiers or '...' before 'size_t'
/usr/include/stdio.h:387: error: format string argument not a string type
/usr/include/stdio.h:389: error: expected declaration specifiers or '...' before 'size_t'
/usr/include/stdio.h:391: error: format string argument not a string type
/usr/include/stdio.h:661: error: expected declaration specifiers or '...' before 'size_t'
/usr/include/stdio.h:664: error: expected declaration specifiers or '...' before 'size_t'
/usr/include/stdio.h:674: error: expected declaration specifiers or '...' before 'size_t'
/usr/include/stdio.h:704: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'fread'
/usr/include/stdio.h:710: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'fwrite'
/usr/include/stdio.h:732: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'fread_unlocked'
/usr/include/stdio.h:734: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'fwrite_unlocked'
configure:4113: $? = 1
configure:4120: ./conftest
./configure: line 4122: ./conftest: No such file or directory
configure:4124: $? = 127
configure:4131: error: in `/root/msk/py_workspace/py_setup/Python-3.4.4':
configure:4133: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
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_ac_ct_CC=gcc
## ----------------- ##
## Output variables. ##
## ----------------- ##
ABIFLAGS=''
AR=''
ARCH_RUN_32BIT=''
ARFLAGS=''
ASDLGEN=''
BASECFLAGS=''
BASECPPFLAGS=''
BLDLIBRARY=''
BLDSHARED=''
BUILDEXEEXT=''
CC='gcc'
CCSHARED=''
CFLAGS=''
CFLAGSFORSHARED=''
CFLAGS_NODIST=''
CONFIGURE_MACOSX_DEPLOYMENT_TARGET=''
CONFIG_ARGS=''
CPP=''
CPPFLAGS=''
CXX=''
DEFS=''
DLINCLDIR=''
DLLLIBRARY=''
DYNLOADFILE=''
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EGREP=''
ENSUREPIP=''
EXEEXT=''
EXPORT_MACOSX_DEPLOYMENT_TARGET='#'
EXT_SUFFIX=''
FRAMEWORKALTINSTALLFIRST=''
FRAMEWORKALTINSTALLLAST=''
FRAMEWORKINSTALLAPPSPREFIX=''
FRAMEWORKINSTALLFIRST=''
FRAMEWORKINSTALLLAST=''
FRAMEWORKPYTHONW=''
FRAMEWORKUNIXTOOLSPREFIX='/usr/local'
GNULD=''
GREP=''
HAS_HG='no-repository'
HAVE_GETHOSTBYNAME=''
HAVE_GETHOSTBYNAME_R=''
HAVE_GETHOSTBYNAME_R_3_ARG=''
HAVE_GETHOSTBYNAME_R_5_ARG=''
HAVE_GETHOSTBYNAME_R_6_ARG=''
HGBRANCH=''
HGTAG=''
HGVERSION=''
INSTALL_DATA=''
INSTALL_PROGRAM=''
INSTALL_SCRIPT=''
INSTSONAME=''
LDCXXSHARED=''
LDFLAGS=''
LDLAST=''
LDLIBRARY=''
LDLIBRARYDIR=''
LDSHARED=''
LDVERSION=''
LIBC=''
LIBFFI_INCLUDEDIR=''
LIBM=''
LIBOBJS=''
LIBPL=''
LIBRARY=''
LIBS=''
LIBTOOL_CRUFT=''
LINKCC=''
LINKFORSHARED=''
LIPO_32BIT_FLAGS=''
LN=''
LTLIBOBJS=''
MACHDEP='linux'
MACHDEP_OBJS=''
MAINCC=''
MKDIR_P=''
MULTIARCH=''
NO_AS_NEEDED=''
OBJEXT=''
OPT=''
OTHER_LIBTOOL_OPT=''
PACKAGE_BUGREPORT='List of issues - Python tracker'
PACKAGE_NAME='python'
PACKAGE_STRING='python 3.4'
PACKAGE_TARNAME='python'
PACKAGE_URL=''
PACKAGE_VERSION='3.4'
PATH_SEPARATOR=':'
PKG_CONFIG=''
PKG_CONFIG_LIBDIR=''
PKG_CONFIG_PATH=''
PLATDIR='plat-linux'
PY3LIBRARY=''
PYTHON=''
PYTHONFRAMEWORK=''
PYTHONFRAMEWORKDIR='no-framework'
PYTHONFRAMEWORKIDENTIFIER='org.python.python'
PYTHONFRAMEWORKINSTALLDIR=''
PYTHONFRAMEWORKPREFIX=''
PYTHON_FOR_BUILD='./$(BUILDPYTHON) -E'
PY_ENABLE_SHARED=''
RANLIB=''
READELF=''
RUNSHARED=''
SGI_ABI=''
SHELL='/bin/sh'
SHLIBS=''
SHLIB_SUFFIX=''
SIGNAL_OBJS=''
SOABI=''
SOVERSION='1.0'
SRCDIRS=''
TCLTK_INCLUDES=''
TCLTK_LIBS=''
THREADHEADERS=''
THREADOBJ=''
TRUE=''
UNIVERSALSDK=''
UNIVERSAL_ARCH_FLAGS=''
USE_INLINE=''
USE_SIGNAL_MODULE=''
USE_THREAD_MODULE=''
VERSION='3.4'
_PYTHON_HOST_PLATFORM=''
ac_ct_AR=''
ac_ct_CC='gcc'
ac_ct_CXX=''
ac_ct_READELF=''
bindir='${exec_prefix}/bin'
build='x86_64-unknown-linux-gnu'
build_alias=''
build_cpu='x86_64'
build_os='linux-gnu'
build_vendor='unknown'
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
exec_prefix='NONE'
host='x86_64-unknown-linux-gnu'
host_alias=''
host_cpu='x86_64'
host_os='linux-gnu'
host_vendor='unknown'
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='NONE'
program_transform_name='s,x,x,'
psdir='${docdir}'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target_alias=''
## ----------- ##
## 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 1

『陸』 如何在已經存在python2的linux環境上安裝python3

如何在已經存在python2的linux環境上安裝python3

有的人態寬盯在安裝的時候可能會先將python2解除安裝掉,這個地方嚴重強調一下,不要去解除安裝系統中已經存在的python2,否則會造成系統中好多其他需要python執行的程式異常
系統環境
[root@localhost install]# pwd
/data/install
[root@localhost install]# cat /etc/redhat-release
CentOS release 6.3 (Final)
[root@localhost install]# uname -a
Linux localhost 2.6.32-358.6.2.el6.x86_64 #1 SMP Thu May 16 20:59:36 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
python3.4的安裝方法
[root@localhost install]# wget :python./ftp/python/3.4.4/Python-3.4.4.tgz
[root@localhost install]# tar -zxf Python-3.4.4.tgz
[root@localhost install]# cd Python-3.4.4
# 在安裝包中有一個README的檔案帆和,裡面有寫如何安裝
[root@localhost Python-3.4.4]# ls
aclocal.m4 config.sub configure.ac Grammar install-sh LICENSE Makefile.pre.in Moles Parser PCbuild Python setup.py
config.guess configure Doc Include Lib Mac Misc Objects PC pyconfig.h.in README Tools
[root@localhost Python-3.4.4]# ./configure
[root@localhost Python-3.4.4]# make
[root@localhost Python-3.4.4]# make install
測試
[root@localhost Python-3.4.4]# python3
Python 3.4.4 (default, Jun 27 2016, 07:47:54)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-16)] on linux
Type "help", "right", "credits" or "license" for more information.
>>>
以後執行python程式就可以使用python3 程式名 去執行了

已經存在python2的linux環境上安裝python3,有兩種方法,第一種是替換python2,第二種是直接安裝python3,而不替換python2,這樣的話,在python3執行的時候,就要寫成python3+啟動等巧禪語句

『柒』 如何在linux下安裝python

1、linux下安裝python3

a、 准備編譯環境(環境如果不對的話,可能遇到各種問題,比如wget無法下載https鏈接的文件)

1
2

yum groupinstall 'Development Tools'
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel

2 下載 Python3.5代碼包

wget https://www.python.org/ftp/python/3.5.0/Python-3.5.0.tar.xz

在安裝包中有一個README的文件,裡面有寫如何安裝

tar Jxvf Python-3.5.0.tar.xz
cd Python-3.5.0
./configure --prefix=/usr/local/python3
make && make install

提示:Ignoring ensurepip failure: pip 7.1.2 requires SSL/TLS

這是原因沒有安裝或升級oenssl:

yum install openssl-devel

再次重復編譯方案python3.5:

最終如下:

提示同時成功安裝pip-7.12與setuptools!

pip3與pip都提示沒有錯誤!

做軟鏈:

ln -s /usr/local/python3/bin/pip3.5 /usr/local/bin/pip

升級pip到最新版本:

pip install --upgrade pip

pip安裝成功啦!

註:--no-check-certificate 表示安裝時「不檢查證書」,不加上可能無法安裝。

2.安裝包

requests包:

pip install requests

pyquery包:

pip install pyquery

pymysql包:

pip install pymysql

『捌』 如何在linux系統安裝python編程環境

詳細說下Linux和Mac OS怎麼搭建Python環境,可以根據需要看對應部分。

打開終端

Linux和Mac OS在安裝過程中均需要打開終端進行操作,這里簡要說明一下如何打開系統終端。由於Linux發行版有太多版本,所以這里只說明國內同學們用的最多的Ubuntu操作系統。Ubuntu操作系統可以使用快捷鍵,Ctrl + Alt + t打開終端,Ubuntu的終端打開之後大概是這樣:

確認是否安裝成功

確認是否安裝成功和確認版本的步驟一致,如果可以正確顯示版本,就是安裝成功了。

希望我的回答能幫到你!

熱點內容
編譯成debug版本 發布:2024-03-29 09:06:55 瀏覽:884
wms伺服器地址 發布:2024-03-29 09:05:55 瀏覽:415
mep編程器 發布:2024-03-29 09:05:13 瀏覽:139
大小s我們一家訪問人 發布:2024-03-29 09:03:16 瀏覽:532
造物者編程 發布:2024-03-29 08:50:27 瀏覽:534
sql技能 發布:2024-03-29 08:50:23 瀏覽:56
希沃安卓下載安裝應用在哪裡 發布:2024-03-29 08:22:51 瀏覽:631
python和excel 發布:2024-03-29 07:47:03 瀏覽:861
postfix源碼下載 發布:2024-03-29 07:42:03 瀏覽:143
怎麼在電腦上玩手機伺服器 發布:2024-03-29 07:30:13 瀏覽:141