Down gói và build từ source với các bước như sau:
1. Yum các gói cần thiết:
#yum install -y
gcc openssl-devel zlib-devel bzip2-devel sqlite sqlite-devel
2. Yum tiếp:
#yum groupinstall
-y "Development Tools"
3. Tạo thư mục /softs và tải gói Python 3.6.2 mới nhất về và
bung gói:
#mkdir /softs
#cd /softs
&& wget http://python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz
#tar -xvf
Python-3.6.2.tar.xz
4. Tạo thư mục cài python mới và tiến hành cài đặt:
#mkdir -p
/opt/python3.6
#cd
/softs/Python-3.6.2
#./configure
--prefix=/opt/python3.6
#make &&
make altinstall
make altinstall sử dụng để tránh ghi đè lên python mặc định
của hệ thống.
5. Check lại phiên bản python3.6 xem nhận chưa:
#/opt/python3.6/bin/python3.6 -V
6. Trong trường hợp muốn xóa python mới:
#cd
/softs/Python-3.6.2
#make clean
#make uinstall
#make -n install
Theo mình tham khảo tài liệu chúng ta có thể dùng Virtualevn
để cài đặt với nhiều lợi ích, chi tiết tham khảo tại:
-
https://daynhauhoc.com/t/neu-cai-song-song-2-ban-python-2x-va-3x-thi-khi-chay-chuong-trinh-se-chon-phien-ban-nao/24300/8
- trang chủ:
http://docs.python-guide.org/en/latest/dev/virtualenvs/
If you are using Python 2.7 I strongly recommend that you
install virtualenv and learn how to use it. Virtualenv makes it possible to create
isolated Python environments. If you are using Python 3.3+ then you don’t need
virtualenv because that functionality is already built in.
Each isolated Python environment (also called sandbox) can
have its own Python version and packages. This is very useful when you work on
multiple projects or on different versions of the same project.
Create your first isolated Python environment
# Install virtualenv for Python 2.7 and create a sandbox
called my27project:
pip2.7 install virtualenv
virtualenv my27project
# Use the built-in functionality in Python 3.6 to create a
sandbox called my36project:
python3.6 -m venv my36project
# Check the system Python interpreter version:
python --version
# This will show Python 2.6.6
# Activate the my27project sandbox:
source my27project/bin/activate
# Check the Python version in the sandbox (it should be
Python 2.7.13):
python --version
# Deactivate the sandbox:
deactivate
# Activate the my36project sandbox:
source my36project/bin/activate
# Check the Python version in the sandbox (it should be
Python 3.6.2):
python --version
# Deactivate the sandbox:
deactivate
Không có nhận xét nào:
Đăng nhận xét