I have just installed repo on my machine.
When I run repo to check whether repo is installed properly, there's a warning:
$ repo
warning: Python 3 support is currently experimental. YMMV.
Please use Python 2.6 - 2.7 instead.
error: repo is not installed. Use "repo init" to install it here.
I added the installation path of repo and python to the user environment.
Please tell me how to use python 2.7 when I need to run repo. Meanwhile, there are some tools that need to run with python 3.6 also.
Modern versions of repo (that is, the 2.x series) support Python 3 just fine, and in fact, do not support Python 2 at all, according to the documentation. It looks like you're using an older version that wants Python 2, so you should upgrade to a newer version.
Since Python 2.7 is now end of life, it's not a good idea to use it for anything anymore since it receives no security updates.
Related
Okay, so I am trying to generate and deploy the documentation of a Python 2.7 based package. The documentation is generated using sphinx, python 2.7.
However, to actually deploy the documentation, I need to use a tool called doctr. This automatically deploys the generated html to github pages. However it requires me to work on Python 3.5 or newer.
So the question is : When the entire travis build is running on python 2.7, how do I temporarily shift to python 3.5 and deploy the documentation?
You can use pyenv to install 3.5 if not already present, and change to it, do your thing, and change back.
Basically this;
pyenv install 3.5.0
pyenv global 3.5.0
<do the deploy>
pyenv global <previous version>
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
I'm trying to follow the instructions here but no matter what I do it seems to be stuck on using Python 2.7.1 which is causing me errors currently.
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3-install-osx.html
Attached is an image showing my logs of upgrading to the newest awsebccli but its still stuck saying 2.7.1 when it should say 3.6 (or newer)
What could I be doing wrong?
I want to note that I also installed the newest version of python3 and python via brew.
Here is the exact error I'm getting if it helps also.
You do not want to upgrade the default python 2.7x installation or the python 3.x installation available on linux or OSX. There are usually lots of other libraries and applications that depend on this default installation. When you want to use a specific version of python the approach is to rely on a virtual enviorenment.
virtualenv is a tool to create isolated Python environments.
You are then leaving the system installation untouched. Getting the hang of virtualenv is quite easy. Once you create it (a one off task). All you need is to activate it and then you can use it as you would normally use the default python interpreter. How to copy packages from one virtualenv (or the system installation) to another is discussed here:
Installing python3 in a python2 virtual environment
My Ubuntu uses python 3.4 as default python. Now I need to use python 2.7. The problems is it's difficult to clearly find out how to switch the default python version , and that numerous libs was installed with python 3.4- which makes python 2.7 unsupported.
Could anyone help me?
Ubuntu has something called Dead Snakes repository from where you can install any version of Python, maintained by Felix Krull.
https://launchpad.net/~fkrull/+archive/ubuntu/deadsnakes
The best practice is to
Install Python from deadsnakes PPA
Create a virtualenv for corresponding Python
virtualenv -p python2.7 my-venv
Then you use this virtualenv for further Python development and deployment
source my-venv/bin/active
Read more about Python virtual environments.
Do not change anything Python related in /usr/bin or symlinks. This breaks all your operating system packages depending on Python.
I've been learning Python for a couple of weeks, and although I've been successfully develop apps for Google App Engine with Python 2.6.5, it specifically requires Python 2.5.
Being mindful of compatibility issues when uploading apps (it's a situation I'd rather avoid while learning Python), I wonder if it's possible to have 2.5 and 2.6.5 installed on the same machine. Ideally I'd like to use 2.6.5 as the default, and configure GAE to somehow use 2.5.
Absolutely.
If you're on *nix, you'd usually just use make altinstall instead of make install, that way the "python" binary won't get installed/overwritten, but instead you'd have e.g. python2.5 or python2.6 installed. Using a separate --prefix with the configure script is also an option, of course.
Some Linux distributions will have multiple versions available via their package managers. They'll similarly be installed as python2.5 etc. (With the distribution's blessed/native version also installed as the regular python binary.)
Windows users generally just install to different directories.
Yes, it is possible to install multiple versions of Python "side-by-side".
On Ubuntu, you simply install with
sudo apt-get install python2.5
(On the current version of Ubuntu, 10.04, python2.6 comes installed by default.)
To use python 2.6, just call python or /usr/bin/python.
To use python 2.5, you call /usr/bin/python2.5.
If you tell us your operating system, we may be able to provide more relevant details.
Another possibility is to use virtualenv.
OK, I figured out the answer to my own question, partly with the help of Nicholas Knight who pointed out that you just install different Python version to different Python directories. I was left scratching my head on how to get Google App Engine to use Python 2.5 (the required version) instead of Python 2.6. This is the answer:
1) Install Python 2.5.
2) Install Python 2.6 (or a more recent version), afterwards. This will be the system default.
3) Install the Google App Engine SDK.
4) Launch, "Google App Engine Launcher" from the Start Menu
5) Click Edit > Preferences, and enter the path to the pythonw.exe executable. Usually c:\Python25\pythonw.exe