4

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?

  • Upgrade my server's Python version to 3.5.2 by adding someone's repo
  • Download Python 3.4.2's tarball and install it to my local machine
  • Upgrade my server's OS to Debian 9 Stretch which its default Python version is 3.5.3

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

*I have some concern on security and safety

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you for the suggestion. But doesn't the Python installed in virtual environment is depend on the Python we run the venv module? Which mean if we want to create a virtual environment with Python 3.4.2 we must first have its binary installed on our linux's global environment?
not necessarily, if I understand your comment correctly. You don't have to make it global for all your Python programs, although you will have to install it locally (no admin permissions, only user, so security problems are minimized). You should be using pip to create the virtualenv and manage it, and when you create it the first time, it will install python 3.4.2 (or whatever version you choose for that particular virtualenv), but again, not for every user, but only for when you run that virtualenv (you have to activate it first as it is described in the docs).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.