Skip to main content

Install Python3实践记录

Install Python3实践记录

Install Python3实践记录

2019年了,在使用python2的时候,偶尔会发现python2将被deprecated,将被弃用了。那么为了能够使用新的包,跟着大众的步伐,安装python3是个不可以少的环节了。下面记录下我的安装以及使用python3的一些记录。

服务器: centos 7 当前python版本: 2.7.5

下载安装包

go to webpage https://www.python.org/downloads/release/python-374/

wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tgz 

简单安装

使用超级用户身份登录,比如 root,然后参考下面的方式安装python3

tar zxvf Python-3.7.4
cd Python-3.7.4
./configure
make && make install

遇到的问题一

Traceback (most recent call last):

File "/root/Python-3.7.4/Lib/runpy.py", line 193, in _run_module_as_main

"__main__", mod_spec)

File "/root/Python-3.7.4/Lib/runpy.py", line 85, in _run_code

exec(code, run_globals)

File "/root/Python-3.7.4/Lib/ensurepip/main.py", line 5, in

sys.exit(ensurepip._main())

File "/root/Python-3.7.4/Lib/ensurepip/init.py", line 204, in _main

default_pip=args.default_pip,

File "/root/Python-3.7.4/Lib/ensurepip/init.py", line 117, in _bootstrap

return _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)

File "/root/Python-3.7.4/Lib/ensurepip/init.py", line 27, in _run_pip

import pip._internal

File "/tmp/tmpo8g_7brw/pip-19.0.3-py2.py3-none-any.whl/pip/_internal/init.py", line 40, in

File "/tmp/tmpo8g_7brw/pip-19.0.3-py2.py3-none-any.whl/pip/_internal/cli/autocompletion.py", line 8, in

File "/tmp/tmpo8g_7brw/pip-19.0.3-py2.py3-none-any.whl/pip/_internal/cli/main_parser.py", line 12, in

File "/tmp/tmpo8g_7brw/pip-19.0.3-py2.py3-none-any.whl/pip/_internal/commands/init.py", line 6, in

File "/tmp/tmpo8g_7brw/pip-19.0.3-py2.py3-none-any.whl/pip/_internal/commands/completion.py", line 6, in

File "/tmp/tmpo8g_7brw/pip-19.0.3-py2.py3-none-any.whl/pip/_internal/cli/base_command.py", line 20, in

File "/tmp/tmpo8g_7brw/pip-19.0.3-py2.py3-none-any.whl/pip/_internal/download.py", line 37, in

File "/tmp/tmpo8g_7brw/pip-19.0.3-py2.py3-none-any.whl/pip/_internal/utils/glibc.py", line 3, in

File "/root/Python-3.7.4/Lib/ctypes/init.py", line 7, in

from _ctypes import Union, Structure, Array

ModuleNotFoundError: No module named '_ctypes'

make: *** [install] 错误 1

解决方法

yum update
yum install libffi-devel

 

版权声明

版权声明

张大鹏 创作并维护的 Walkerfree 博客采用 创作共用保留署名-非商业-禁止演绎4.0国际许可证。本文首发于 Walkerfree 博客(http://www.walkerfree.com/),版权所有,侵权必究。本文永久链接:http://www.walkerfree.com/article/167