I am not familiar with the linux system and I have already uninstalled Ubuntu 15.04 for 5 times due to improper operation. Please forgive it if my question is some kindly stupid or too easy for you because I really do not want to uninstall Ubuntu again.
There are few question I really need to make clear.
1) On Ubuntu 15.04, the default python is 2.7.9. Now I need to use jupyter notebook so that I choose to install Anaconda. The latest version of anaconda is for python 2.7.11. So do I need to update my default python version to 2.7.11 so that I can use jupyter notebook rightly? Because after I installed the Anaconda for python 2.7.11, the jupyter notebook could not new a python2 script. Hence should I turn to the Anaconda for python 2.7.9?
2) Questions about how to update the python version of Ubuntu exist a lot but I need to make sure what is the rightest and newest one because python is changing everyday.
In this stackoverflow question The Python 2.7 on Ubuntu, this method is recommended the most.
$ python -V
Python 2.6.6
$ curl -kL https://raw.github.com/utahta/pythonbrew/master/pythonbrew- install | bash
$ . $HOME/.pythonbrew/etc/bashrc
$ pythonbrew install 2.7.1
$ pythonbrew switch 2.7.1
Switched to Python-2.7.1
$ python -V
Python 2.7.1
But I saw the comment "should probably use pyenv instead of pythonbrew". So, if I need to work on multi-python environment, is pyenv the newest and most recommended one?
3) If I want to choose the easiest method so that I could use jupyter notebook rightly, is the anaconda for python 2.7.9 the most recommended choice?
Thank you all a lot!
If I understand you right, what are you trying to do is to update Ubuntu's system package.
What I did in the past is I have downloaded newest python, compiled it on my own and then started virtualenv that was using this freshly compiled python. However this process is a bit cumbersome and error prone.
I checked pyenv and pyenv-virtualenv, I think you should try it ( especially later one).
However perhaps Anacodna will work with python 2.7.9 and there is no need to update anything? In general difference between version 2.7.11 and 2.7.9 should be very minor.
Related
I have used python 3.8.13 as installed by Homebrew for years, mostly with jupyter-lab for coding in notebooks. Recently I ran brew to install a package and it looks like it installed python 3.10: brew list shows both python#3.8 and python#3.10 and running python3 from the command line gives me a 3.10 session, with no knowledge of my site-packages...
I either want to:
remove python 3.10 and continue using 3.8 as I was. python#3.8 would then be the python3 command as it was before.
or
change over to using python 3.10 and have all the site-packages installed when using 3.8 "come with". In particular, jupyter-lab needs to know about them in the 3.10 environment so my notebooks keep working.
Could someone help me with either of these? I'm not familiar enough with brew or python to clearly see how to do either to completion. Thanks so much.
This question already has answers here:
Use different Python version with virtualenv
(41 answers)
Closed 4 years ago.
On my osx machine I have python 2.7.15 running.
When I run virtualenv, activate the env, and check the python version, i get 2.7.10.
$> virtualenv env
Unfortunately, I really need version 2.7.15. I tried to specify the virtualenv version by adding the path to /usr/bin/python2.7, but it still creates an env using python 2.7.10.
Any idea how I can set up the version more specifically ?
Similar question: With Python 2.7.15 on a MAC console, virtualenv creates an environment with a different version of Python
SOLVED:
This question solves it but maybe the phrasing of the question was too specific. It solved my issue though. With Python 2.7.15 on a MAC console, virtualenv creates an environment with a different version of Python
Maybe keep this one open for more visibility? It's not about choosing the version, it's about finding where the sub-version (e.g., 2.7.10 or 2.7.15, etc.) is located on the machine. Obviously passing the python interpreter as command line was tried before posting to Stack Overflow.
The trick is that virtualenv uses the python version used to install virtualenv, not the one currently running. Therefore its a matter of finding the right version on your machine.
The python subversion can be located here:
/usr/local/Cellar/python#2/2.7.15/bin/python
You can therefore create virtualenv like this
virtualenv -p /usr/local/Cellar/python#2/2.7.15/bin/python
When you define your virtual environment you should attach a version of python to that environment. See my comment above if you are using anaconda. So when you create your virtual environment be sure to put the exact version of python. For example use 2.7.15 instead of 2.7
You can try pyenv, where you can install as many Python versions as you want. First you need to install Homebrew:
$ brew update
$ brew install pyenv, pyenv-virtualenv
$ pyenv install 2.7.15
$ pyenv virtualenv 2.7.15 my-virtualenv
$ pyenv activate my-virtualenv
I'm using Ubuntu 14.0.4. In my system I have installed Anaconda with python 2.7.14. Now I want to upgrade my python version & would like to use Python 3.6.3. So I followed the steps mentioned in below link
Update python on linux 2.7 to 3.5
But after doing this my python --version command is showing python 2.7.14. Can you suggest me how to upgrade?
It's a little bit tricky with Anaconda.
You need to do this within your Anaconda environment:
conda install python=3.6.3
I am currently trying to run Pydev with Pymongo on an Python3.3 Interpreter.
My problem is, I am not able to get it working :-/
First of all I installed Eclipse with Pydev.
Afterwards I tried installing pip to download my Pymongo-Module.
Problem is: it always installs pip for the default 2.7 Version.
I read that you shouldn't change the default system Interpreter (running on Lubuntu 13.04 32-Bit) so I tried to install a second Python3.3 and run it in an virtual environement, but I can't find any detailed Information on how to use everything on my specific problem.
Maybe there is someone out there, that uses a similar configuration and can help me out to get everything running (in a simple way) ?
Thanks in advance,
Eric
You can install packages for a specific version of Python, all you need to do is specify the version of Python you want use from the command-line; e.g. Python2.7 or Python3.
Examples
Python3 pip your_package
Python3 easy_install your_package.
I want to uninstall python 2.6.5, and install python 2.7.3
but there is so many other software relay on it.
so how can I up upgrade python in ubuntu10.04?
I used this link to do the same(i.e the installation part), after doing this the default python version will change to 2.7.3.
Another useful link How do I install python 2.7.2 on 10.04?.
Why do you want to uninstall the old one? You can install python 2.7 and just create a virtualenv that points to it: Use different Python version with virtualenv
Aside from that, it's rather risky to upgrade it, if you don't want to upgrade the whole system.