python version on python server - python

I use pyenv to manage python versions. I'm using Python 3.4.1 :: Anaconda 2.1.0 (x86_64), but in python cgi running on python server, python version seems to become 2.7.10.
How can I fix this to use version 3.4.1 on python server?

If you run python3 --version on the server, what version is it ? I'm making the assumption that you are using a newer version of Linux on the server which might be shipped with both a Python 2.7.x and Python 3.x version.
If not, you'll have to download and install it yourself, preferably into it's own location, as you do not wish to override the system version of Python that can be used for things such as package management.

Related

Python version through console is different from downloaded?

Recently, I have downloaded Python 3.10, after installation I opened the console to check the version but what I got is version 2.7.16 !!
I have not installed python before and what about the newer version that I installed?
OS --> macOS Big Sur
IDE--> PyCharm
macOS Big Sur comes pre-installed with Python 2.7. That is why you have version 2.7.16 installed on your PC. Uninstalling Python on a Mac is rather complicated, you can keep both Python 2 and Python 3. Just make sure to refer to Python 3.1 as python3 in the console.
To check what version PyCharm is using, go to Settings > Project Interpreter. If it's using Python 2.7, you can change it to Python 3.1.

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?
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
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

How to install python 3x on Mac without overwriting 2.7 installation?

As Mac comes preinstalled with Python per this:
python --version
Python 2.7.14 :: Anaconda, Inc.
I also need to have Python 3.x installed for software that specifically calls for it. How do I install the 3x version without overwriting my Python 2.7.14 version?
I'm planning on download/installing Python 3.x from here.
I've found this information but it doesn't seem to say that the process will not overwrite my existing Python
My Mac has High Sierra installed.

Cygwin not same python version as windows

Background:
I am a .NET developer trying to set up a python programming environment.
I have installed python 2.7.5. However I changed my mind and uninstalled 2.7.5 and installed python 2.7.6.
If I CMD in windows command promopt, the python version is 2.7.6
When I start the cygwin shell and type:
python --version
It says 2.7.5, this version is was uninstalled.
How do I get cygwin to understand it should use the new version. 2.7.6?
I believe there is commands to type in cygwin shell to solve this? Thanks on advance!
Cygwin has its own option to install its own version of Python. If you run setup.exe and poke through the Development packages, you'll find it. You probably installed Python here as well, and are running it in Bash. If you use CMD, you're running a different version. The fact that the version numbers overlap is just coincidental.

using different version of python with idle windows7-64bit

I have Python 3.2 and python 1.5.2 installed on my system
(windows 7 64bit)
i can run only IDLE which installed with python version 3.2
IDLE for 1.5.2 is not compatible with 64bit systems
i need to test some code specially for version 1.5.2
how can i make IDLE to use 1.5.2 interpreter instead of 3.2
or any other way to test python 1.5.2 scripts without idle
Thanks in advance
you can run your script with a given interpreter from command line (cmd.exe)
c:\path\to\python1.5.2\python.exe your_python_script.py
You could use Python Launcher for Windows to run easily your_python_script.py using different Python version.
Also pylauncher allows you to indicate in the script what Python version it expects (in the #!-line (shebang)) and run it automatically.

Categories

Resources