I am on an Ubuntu virtual machine and I am trying to update my version of python on the command line. I followed the instructions here
and eventually ran $ sudo apt-get install python3.6 but when I run python3 --version it tells me my python version is 3.5.2
I am following a tutorial on heroku about building a web app using python for the server side and it says I need python3.6 installed. But when I got to the step where it was really needed, I found out it wasn't actually installed.
Any ideas?
Installing the python3.6 package doesn't touch your existing system Python installation. Python 3.5 is still installed as you saw by the output of $python3 --version. To invoke Python 3.6, you can use: $python3.6
Related
This is the first time I have installed Ubuntu and Python in my Windows laptop, and upon checking, it seems that my Python version is 3.8.5.
python3 --version
Ubuntu WSL
However, when I check my cmd, and run
python --version
I'm getting 3.7.9. Just curious as to what the difference is as I don't remember installing 3.8.5
CMD
Because these are different pythons.
Try to run
> where python
You'll probably get something like
C:\Users\user\AppData\Local\Programs\Python\Python37\python.exe
C:\Users\user\AppData\Local\Microsoft\WindowsApps\python.exe
And then run
$ which python3
inside your WSL. You may get
/usr/bin/python3
which is different from Widows' executable. WSL has its own filesystem which doesn't share files with the parent system and python executables also aren't shared.
When you install a package / program in wsl, you installing it separately, this mean you not installing on your local os storage, but in wsl environment where you can access it.
You are installed python on own local machine, for example python 3.9, if you will install just python
sudo apt-get install python you will install python 2.7, this mean you are installing python on wsl, and another python have in own os, if you want to have the same version, try to install on your os and wsl the same version
in ubuntu you can do :
sudo apt-get install python( for python 2.7 )
sudo apt-get install python3.9( for python 3.9.5 )
I had python 3.8 installed and then I installed python 2.7. I am trying to run a python program with py -2 program.py in vs code using with python 2.7 as selected environment and I am getting an error, ImportError: No module named googlemaps even though I have already installed.
If I run the program using Python3 then it would run fine. Also when I open vs code using python 2.7 as selected runtime environment then I would get a warning Linter Pylint is not installed. If I click on install then I would get another warning There's no Pip installer available in the selected environment.
Also even though I have changed the python path from 3.7 to 2.7, default python version will still show up as 3.7 when I runPython in command line.
Things that I have tried to install the googlemaps module for python 2 after googling for solutions,
pip2 install googlemaps--upgrade
py -2 -m pip install googlemaps
If you have your python2 binary located, you can just call it directly:
/usr/bin/python2 -m pip install googlemaps
And if you're not sure where your python binary is, you can use
import sys
print(sys.executable)
to locate it.
And if you don't have pip, you should install it by downloading this file:
https://bootstrap.pypa.io/get-pip.py
then running:
/usr/bin/python2 get-pip.py
It is recommended to install Python 3.8 using Pyenv and also when you are using different versions of python, it is very useful
curl https://pyenv.run | bash
pyenv install 3.8.1
pyenv virtualenv 3.8.1 venv
pyenv local venv
with pyenv local you set your version for use.
If after this you run
pyenv version
It will output to 3.8.1
With regards to pip installation, run
whereis python
and if it outputs to
usr/bin/python2
then you can use pip for installing python2 packages and pip3 for packages compatible to python3.
I'm a new Python user. I'm having issues installing new modules for python 2.7. When I try installing a new module from PyCharm, I get the following error
Error: Python packaging tool 'pip' not found
Moreover, I'm a bit confuse about which Python version I'm actually using...
This is what I get when I type the following commands in the terminal.
$ which python
/usr/bin/python
$ echo $PYTHONPATH
PYTHONPATH:/usr/local/lib/python3/dist-packages/
$ python -V
Python 2.7.6
Everything seems a bit messed up to me...all the procedures I follow to install pip result in failure. The command
$ python get-pip.py
returns
You are using pip version 7.1.0, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command
However, when I run that command, it tells me that there is no module named pip.
Please, how can I fix it? I need to work with Python 2.7 but I'm completely unable to install packages. Thanks.
EDIT I am using Ubuntu 14.04 LTS
You may be trying to install pip wrong. Depending on your version of linux there are several install methods that can be found here
for your version judging by your use of get.
try this one:
sudo apt-get install python-pip
Ubuntu 14.14 server itself has installed Python 3.4 in default, however, I need to use Python 3.5 for certain packages. So I install it by myself.
The problem is that every time I try to install packages by running "pip3 install xxx". It always installs under Python 3.4 rather than 3.5.
Please show me some lights on how to use Python 3.5 properly on Ubuntu. Many thanks for any good suggestions!
To install it to the right version of python, type:
sudo python3 -m pip install [package]
Now this is assuming the name of Python 3.5 is python3.
If this is not the case,
Create an alias of Python 3.5 to some name
Replace python3 in the snippent above with that name.
Execute the command.
I'm currently following this guide to install python and its libraries onto my Mac OS. http://www.nyx.net/~mlu/pages/computing/installing_and_configuring/installing_and_configuring_Python_on_Mac_OS_X/#.WCLNgeErJE4
In step 4, I brew installed python and python3
Upon checking the path of python and python3, I found that python was in /usr/bin/python while python3 is in /usr/local/bin/python3
How do I get my python to install in /usr/local/bin?
UPDATE
Upon looking on my terminal, I can see that the brew install python had installed it in /usr/local/bin (version is 2.7.12) but somehow I am accessing a python that was installed in /usr/bin (version is 2.7.10). How do i fix this?