hashlash
hashlash

Reputation: 1015

Development using different version of Python

I'm developing a website using a server with Debian 8.10 (Jessie) as its OS and Python 3.4.2 (the supported Python version for Debian Jessie) while my notebook is using Ubuntu 16.04 and Python 3.5.2 (I think it's also the default version for Ubuntu 16.04). I was planning to build my website using Django 1.11 which both Python versions (3.4 and 3.5) support.

Is there any compatibility issues when I develop it using my Python 3.5.2 and deploy it to a Python 3.4.2 server? If any, how much the trouble it will be?

I know I can install any version of Python by adding someone's repository, but it seems unofficial so I avoid doing it. And there is a workaround that come to my mind: intall a specific version of Python by download its tarball file from the official website

Which will you recommend most?

Or any other better idea? Or perhaps you have a way to install specific Python version?

*I have some concern on security and safety

Upvotes: 4

Views: 126

Answers (1)

OscarD
OscarD

Reputation: 106

When you are working with different Python versions, it is recommended that you use some kind of virtual environment so each project has its own python version with its own modules that you need. In this way, you can always keep each project with the Python version that you know it will work and with total compatibility with all the modules that you are using, making sure that any update to your working modules does not break anything in your past projects.

You should install a virtual environment in your local machine that matches the server machine and match the Python version and the modules that you have available, then start developing from there.

This space is a little bit too short to explain how to work with them, but you can find information about them here: https://docs.python.org/3/tutorial/venv.html

Optionally, you could use anaconda and its own version of enviroments, that may be simpler if you are familiar with conda

Upvotes: 1

Related Questions