make python3.5 as default in AWS?

女生的网名这么多〃 提交于 2019-12-22 08:13:43

问题


Is there a way to make python3.5 as the default python in AWS. every time i try the next time i connect python2.7 is the default one and pip 6 is the last version, knowing that I did updated it some minutes before. here is the method i followed : amazon_link

here is another link of amazon telling the versions, actually they are at 3.5 another_link

Thank you in advance, :) best wishes


回答1:


alternatives --set python /usr/bin/python3.5

and then back if you want to

alternatives --set python /usr/bin/python2.7

If you want to see what it currently points to

alternatives --display python

This is a system-wide setting not just for the current user. The system settings are stored in /etc/alternatives




回答2:


A simple safe way would be to use an alias. Place this into ~/.bashrc or ~/.bash_aliases file:

alias python=python3

Example
$ python --version
Python 2.7.6
$ python3 --version
Python 3.4.3
$ alias python=python3
$ python --version
Python 3.4.3



回答3:


that's me again :) I found the answer, the problem is that I was working with the global python and pip, and AWS is refreshing it every connection. I created un environment and updated python and pip inside, that works great.




回答4:


do above: alias python=python36 in ~.bashrc file (Use emacs, vim, your favorite editor - emacs ~.bashrc) then save file.

then in command line terminal type: source ~/.bashrc (for changes to take effect)




回答5:


By default, the awscli-bundle install script runs under the system default version of Python. To answer your question you will need to know the path of Python version to use. Then run:

$ sudo /path/to/python/version awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws

In my case I would run:

$ sudo /usr/local/bin/python3.7 awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws


来源:https://stackoverflow.com/questions/45220230/make-python3-5-as-default-in-aws

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!