centos7安装python3.7.2_在centos7中安装python2和python3,Centos7,的

一、Python2 and pip2

由于Centos7自带Python2.7,所以就不说它的安装的,主要是安装pip2:

我的个人文件夹:

/home/jhuang/regit

执行命令:

wget -P /home/jhuang/regit https://bootstrap.pypa.io/get-pip.py && python /home/jhuang/regit/get-pip.py

二、 Pyhton3.8的安装

执行命令:

cd /home/jhuang/regit && curl -O https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tar.xz && tar -xvf Python-3.8.0.tar.xz && cd Python-3.8.0/ && ./configure && make && make install

注:python3.8的pip3的版本较低,需要升级:

pip3 install --upgrade pip

”,

pip3 install --upgrade setuptools

✿ 安装完后可能会出现的错误如下:

1.

ModuleNotFoundError: No module named '_ctypes

错误解决方案:

[jhuang@localhost ~]$ pip3 install bs4

Defaulting to user installation because normal site-packages is not writeable

Collecting bs4

Using cached bs4-0.0.1.tar.gz (1.1 kB)

ERROR: Command errored out with exit status 1:

command: /usr/local/bin/python3.8 -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/tmp/pip-install-6httvll3/bs4/setup.py’"’"’;

file

=’"’"’/tmp/pip-install-6httvll3/bs4/setup.py’"’"’;f=getattr(tokenize, ‘"’"‘open’"’"’, open)(

file

);code=f.read().replace(’"’"’\r\n’"’"’, ‘"’"’\n’"’"’);f.close();exec(compile(code,

file

, ‘"’"‘exec’"’"’))’ egg_info --egg-base /tmp/pip-install-6httvll3/bs4/pip-egg-info

cwd: /tmp/pip-install-6httvll3/bs4/

Complete output (11 lines):

Traceback (most recent call last):

File “”, line 1, in

File “/home/jhuang/.local/lib/python3.8/site-packages/setuptools/

init

.py”, line 19, in

from setuptools.dist import Distribution, Feature

File “/home/jhuang/.local/lib/python3.8/site-packages/setuptools/dist.py”, line 36, in

from setuptools import windows_support

File “/home/jhuang/.local/lib/python3.8/site-packages/setuptools/windows_support.py”, line 2, in

import ctypes

File “/usr/local/lib/python3.8/ctypes/

init

.py”, line 7, in

from _ctypes import Union, Structure, Array

ModuleNotFoundError: No module named '_ctypes’

----------------------------------------

ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

安装:

yum -y install libffi-devel

,然后再去Python3.8的目录重新安装:

./configure && make && make install

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值