M
M
MiroMichail2015-10-21 21:14:08
Python
MiroMichail, 2015-10-21 21:14:08

Multiple python versions on nginx, how to choose default version?

I use the homestead image, it has python 2.7 and python 3.4. nginx server. The default is 2.7. How to make it used 3.4? I know that you can also use a virtual environment, I figured out how to set it up, but not how to use it :) I'm just starting to work with python, I will be grateful for any advice!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dimonchik, 2015-10-21
@MiroMichail

habrahabr.ru/post/203516
virtualenv
but look at the tasks, you can’t completely refuse 2.7, so sometimes it may not matter what is there by default (although, of course, the 3rd Python is unicode, etc.)

R
Roman Kitaev, 2015-10-21
@deliro

1) It is impossible to set the 3rd python by default.
2) To work interactively in the console with python from virtualenv, you need to go to the folder with env and source bin/activate
3) To run the script from python from env:/home/your_name/env/bin/python some_script.py

O
Oleg Tsilyurik, 2015-10-21
@Olej

there is python 2.7 and python 3.4.

Python 2 and Python 3 are not syntactically compatible in many ways .
If you do it by default on a Python 3 system, then many utilities will become inoperable ... and you will simply break the system (although this depends on the system, Python 3 is already the default in Fedora 22).
And if you only need to run your own script, then write it in the 1st line:
#!/usr/bin/python3
...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question