When I enter
python --version
it gives:
bash: python: command not found
but when I enter
sudo apt-get install python
it gives:
python is already the newest version (2.7.16-1).
When trying to locate the python files, they appear mostly in /var/lib/dpkg/info/ or in /home/pi/.local/bin/, therefore are present in the system, however they do not appear where they would normally be found in /usr/local/bin.
The same thing goes for the pip, python3 and pip3 files.
How do I fix this so that I can use the python command?
To install python to the newest version run sudo apt-get install python3
You then need to run python3 for linux based systems so python3 --version should work.
Related
I have Ubuntu 18.04. I want to upgrade to python 3.x
When I do:
python --version
I get:
Python 2.7.17
But then I run:
sudo apt-get install python3
it says:
python3 is already the newest version (3.6.7-1~18.04).
I guess this means that I have more than one version of python on my laptop? What's the best way for me to clean this up? Should I delete one? I made a bit of a mess installing / uninstalling anaconda / miniconda at various points in my life, and so that has probably not helped.
I just want to have a clean install of python 3, and then I will reinstall miniconda after.
To run Python 3 instead of Python 2 type:
python3
If you want Python 3 to run by default you can add the following to the aliases section of your .bashrc:
# some more ls aliases
alias python='python3'
To update Python3:
sudo apt upgrade python3
I have installed new ubuntu 18.4 and while solving some other error while installing requirements through pip. I tried installing python-setuptools and python-dev instead of installing python3-setuptools and python3-dev which in turn installed python2.7 on my machine. Well the solution didn't work and I removed the packages as I don't want 2.7 on my machine and now when I run the following command:
sudo virtualenv venv
I get this message: The path python2 (from --python=python2) does not exist.
before installing python-dev and python-setup tools the above command worked fine.
I have tried replacing python symbolic link to python3.6 in /usr/bin.
by executing: ln -s /usr/bin/python3.6 /usr/bin/python although I am able to get python3.6 console every time run python like on fresh install of ubuntu but I can't creat virtual environment the same way.
Try yo run it with this specific python
/usr/bin/python3.6 -m pip install virtualenv
sudo /usr/bin/python3.6 -m virtualenv venv
and delete the python2.7 is probably a bad idea cause there is probably thing that using it on your machine, and also, consider reading about system envirmate varibles, as PATH for example that would solve you problem
I need to get pip3 running on my Mac terminal for a project. I have python3 installed, and I can run it, but when I try to run pip3 freeze, it says my command is not found.
I thought it would be automatically installed when I installed Python3. I tried to sudo install it, but it still didn't do anything. What can I do?
Besides brew install pip3, in case brew is not installed on your Mac, you can install pip3 via get_pip.py which can be found here. Assuming that python3 is already installed, cd to the directory where you saved get_pip.py and run the file with python3 get_pip.py. This should get pip3 installed on your machine.
On my MacBook Pro (10.13.5), which pip3 shows that it is located at /opt/local/bin/pip3 but it is a symlink to /opt/local/Library/Frameworks/Python.framework/Versions/3.6/bin/pip3.
This is the location of python3 if you installed it via MacPorts. If you installed it with HomeBrew, then it would be /usr/local/Cellar/python/3.7.0/bin/pip3 (again, version might vary).
Finding pip3
What I would do if I were you is first find out where your pip3 actually is by either using locate or trying to manually find it by typing (Change 3.6 to whatever version you're on.) either:
$ /opt/local/Library/Frameworks/Python.framework/Versions/3.6/bin/pip3 --version
or:
$ /usr/local/Cellar/python/3.7.0/bin/pip3 --version
You should see something like:
pip 9.0.3 from /opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (python 3.6)
Otherwise, use locate:
$ locate pip3
As a last resort, the slow find can also be useful:
$ sudo find / -name pip3
Build a Symlink
Then, make a symbolic link to that file in a path that is in your $PATH (again, ensure you replace the first path with the path to your actual pip3):
$ sudo ln -s /opt/local/Library/Frameworks/Python.framework/Versions/3.6/bin/pip3 /opt/local/bin/pip3
Assuming you are using Python 3.4 or later in which pip is included by default, try the following command:
python3 -m pip freeze
When you use the -m command-line flag, python will search sys.path for the named module and execute its contents as the __main__ module. (more here)
This solution will allow you to use pip by python3 -m pip, but in order to use pip3 directly you can:
Install it via Homebrew:
brew install pip3
Install it with get-pip.py:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
You could try brew install pip3. Or check where pip is installed, that might point to Python 3's version.
Any possible command on terminal of ssh hadoop environment to install and run python without using pip or brew? Also, I have already tried
yum install python
that gives me Python version 2.6 that creates more trouble.
You will not find a python3 installation via yum. You should simply use the standard python.org installation:
wget https://www.python.org/ftp/python/3.4.5/Python-3.4.5.tgz
tar xfz Python-3.4.5.tgz
cd Python-3.4.5/
./configure
sudo make altinstall
Go to python.org to choose your desired Python version to install.
I'm trying to install a program from a .deb file on Linux mint, but getting an error at installation as the program requires python >=3.5 (I have 3.4.0 as default). I've installed 3.6.0 but the defualt version appears first in the path (I don't think I want to change this?) so installation still fails.
I've tried to change the local python to 3.6.0 using pyenv, but it still only recognises the default 3.4.0 version. Any ideas what to try?
You can use ppa:fkrull to install python3.5.
sudo add-apt-repository ppa:fkrull/deadsnakes
sudo apt-get update;
sudo apt-get install python3.5
It surely helps to others
Help:If you want to install python3.6 see this link python3.6