How can I install python2.7 on Ubuntu 14.04 and make the system's default python the python I installed?
How can I install packages like numpy, scipy and so on in the python I installed? I don't know how to set these settings.
As Selcuk and warmoverflow said, both versions of python , python 2.x and 3.x comes already installed on ubuntu. However if you want to upgrade your python version, say python 2.7.6 to python 2.7.11 or so, you can upgrade it by downloading the latest version and building it from source.
Here is a good tutorial for that : Tutorial 1 Tutorial 2
You can also search on internet for the same.
Related
I am brand new to programming and installed Python 3.10 from the website (not via terminal). When I began to run code, my computer ran python 2.7 by default. In order to fix this, I installed Python with Brew which updated my default Python version to 3.9.13. However, when I now install libraries like Requests (pip3 install requests), they are installed in the Python 3.10 version I originally downloaded.
Here's where my libraries go:
requests in /usr/local/lib/python3.10/site-packages
My current version:
python --version Python 3.9.13
I am not sure if it is best to set default version to 3.10 or to some how install libraries in 3.9.13.
Please advise.
I have installed version 3.8.2 on my RPI because i previously had versions 2.7 and 3.5.3 installed. When I try to install stuff like ipython i get this: ERROR: Package 'ipython' requires a different Python: 3.5.3 not in '>=3.6'.
Tried various stuff and nothing works. Modified paths, installed 3.8.2 multiple times, tried to remove 3.5.3. Nothing works. It appareas the base version is 3.5 but I need it to be 3.8.2 and no idea how to do that.
Also when i try to run a python file I get the error that it cannot find numpy, and I have numpy installed in all versions.
Struggled for over a day to fix it and nothing. Can anybody help?
versions of python on RPI
Python is a requirement of Debian, hence uninstalling the version present by default is not recommended (it basically breaks the system).
If you need to run python 3.8 you should install it manually and call it with
python3.8 what_you_need.py
Also for pip:
python3.8 -m pip install what_you_need
I also suggest you to have a look to virtual environments:
https://docs.python.org/3/library/venv.html
https://github.com/pypa/pipenv
I have Ubuntu 14.04 LTS. I guess different versions of python are pre-installed in Ubuntu 14.04. Right now when I type 'python' in terminal it opens python 2.7.11, but I guess the default version of Ubuntu 14.04 is 2.7.6. When I type /usr/bin/python it opens the default version. I know this can be done with making aliases. The real problem is, I have installed pygame, cv2 (that is for image processing) using apt-get. These are installed for default version of python i.e python 2.7.6. Also I have installed anaconda with python 2.7.11 using pip, but again 'pip' and anaconda are installed for 2.7.11. I know python 3 is also pre-installed there but I don't use it. Also I have no python version installed in user/local/bin.Now I want to know why this problem is occurring? How can I fix this now? Also how to import all the libraries for one python version(either default or another) and how to use it? How to configure my settings so that I would not have any problem in future?
If you have easy_install installed you can run
sudo easy_install pip
to install pip. As far as installing Anaconda goes, try using this stack overflow question's answer. If you can't get that to work comment explaining the issue.
First of all I want to thanks Bennet for responding to my question so that I was able to figure out what the problem was. Actually the problem was with aliasing. When I installed cv2 or pygame using apt-get, they were installed for default version but when I installed any package by downloading the installer first (like I installed anaconda), it was installed for python 2.7.11 because 'python' was aliased for this version(that is 2.7.11). So, basically make sure that the default version for which you want to install everything is the one which is aliased as 'python', and everything goes fine. I aliased 'python' for the default version and then installed anaconda via installer and now it has been installed default version.
I'm having trouble making MySQL connector work with Python.
I started with a fresh new installation of Red Hat 6.4.
The system already had Python 2.6.6 installed by default, I need however version 3.4
I downloaded, compiled and installed Python 3.4 from here (https://www.python.org/ftp/python/3.4.4/Python-3.4.4.tgz)
I downloaded and installed the MySQL yum repository from here (http://dev.mysql.com/get/mysql57-community-release-el6-8.noarch.rpm)
Installed mysql-community-server version 5.7 with yum
Finally I installed mysql-connector-python with yum (version 2.1.3)
Now it looks like the module works in Python 2.6.6 but it can't find the module with Python 3.4.
I'm a bit stuck with how to get round this.
Since you got the mysql-connector via yum, it's installed for the system python. Your custom python 3 environment doesn't know about it.
So it's probably best to do the following:
Get pip and install it for your python 3. Make sure that python points to your custom installation when executing python get_pip.py
Get the source distribution of the mysql-connector: https://dev.mysql.com/get/Downloads/Connector-Python/mysql-connector-python-2.1.3.tar.gz
Use your just installed pip to install the mysql-connector from source into your python environment: pip install path/to/mysql-connector-python-2.1.3.tar.gz
Alternatively you might look into using virtualenv.
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.