How can I install python-gasp on Ubuntu 16.04? - python

I use a Ubuntu 16.04 system, and I want to install the gasp for python.
I was told that the following commands can help me to install the python-gasp:
$ sudo apt-get install python-gasp
I tried the commands, but it seems not to work, because when I run
from gasp import
it returned as
"No module named gasp".
Then I use $ whereis python-gasp to check the location of the python-gasp I installed, and it returned as /usr/share/python-gasp
I don't know what happened.
How can I use gasp successfully?

python-gasp is module for Python 2. I don't see python3-gasp for Python 3 (Linux Mint 17 based on Ubuntu 14.04) but maybe you have on Ubuntu 16.
Ubuntu 16 as default use Python 3. Maybe you will have to install Python 2 to use gasp.
Or maybe you already have installed. Try python2 or which python2 to find path.

Related

How to change python3 version on mac to 3.10.10

I am currently running python 3.9.13 on my mac. I wanted to update my version to 3.10.10
I tried running
brew install python
However it says that "python 3.10.10 is already installed"!
When i run
python3 --version
in the terminal it says that i am still on "python 3.9.13"
So my question is, how do i change the python version from 3.9.13 to 3.10.10? I already deleted python 3.9 from my applications and python 3.10 is the only one that is still there.
I also tried to install python 3.10.10 from the website and installing it. However it does not work. Python 3.10.10 is being installed successfully but the version is still the same when i check it.
Python 3.10.10 is already installed along with Python 3.9.13. Your path is probably pointing to 3.9.13 and that's why you're getting that Python version.
Try modifying your path variable to point to brew's Python installation, or (better yet) make use of a virtual environment.
a) Telling what Python version your PATH variable is pointing to:
$ which python
Will tell you what's the actual executable's path. That way, you are going to see exactly where you main python resides.
b) If you want to create a virtual environment with brew's python try something like:
$ /usr/local/Cellar/python#3.10/3.10.1/bin/python3 -m venv py310
$ source venv/bin/activate
$ python
> # you should be inside a 3.10.1 envornamente
> CTRL+D
$ pip install requests
you can use pyenv to work with multiple python environments
things to do:
install pyenv : brew install pyenv
install particular python: pyenv install 3.10.10
set python3.10.10 to gloabal python env: pyenv global 3.10.10
and can start using python 3.10.10 version
Just delete the current python installation on your device and download the version you want from the offical website. That is the easiest way and the most suitable one for a beginner.

Multiple Python versions in the same Ubuntu machine

I am on an Ubuntu machine, where Python 3.10 is automatically installed. To do a given task in a shared codebase I need to use Python 3.9 for some issues with new versions.
I would like to have both of the Python installed on my machine and be able to use both and switching if I need to.
So, I am trying to install old Python 3.9 with the command sudo apt-get install python3.9 and it succeeded in installation, but I can't find it anywhere even with which python3.9 and similar.
Even the python interpreter option in VSCode does not show it.
I think I am missing something. Can please someone help me? Thank you
Python should be installed under the /usr/bin/ folder. If it's not there, you might have not actually installed the package.
Check out this guide for installing specific versions (Scroll down to the "Use Deadsnakes PPA to Install Python 3 on Ubuntu" section.)
This will allow you to install specific version of python like python3.9
Packages on Ubuntu (usually executables) are installed in the /usr/bin directory. You could try to list all executables under /usr/bin with
ls /usr/bin/python*
This is the easiest way. You could see also what packages are installed
apt list --installed | grep python

How to properly install python3 on Centos 7

I'm running Centos7 and it comes with Python2. I installed python3, however when I install modules with pip, python3 doesn't use them. I can run python3 by typing python3 at the CLI
python (2.x) is located in /usr/bin/python
python3 is located in /usr/local/bin/python3
I tried creating a link to python3 in /usr/bin/ as "python", but as expected, it didnt resolve anything. I renamed the current python to python2.bak It actually broke some command line functionality (tab to complete). I had to undo those changes to resolve.
Suggestions welcome. Thanks.
The IUS project has ready to go RPM packages of python34u-pip, python35u-pip, and python36u-pip. These will give you corresponding pip3.4, pip3.5, and pip3.6 commands. As expected, the packages installed by those will be available to the corresponding python3.4, python3.5, and python3.6 interpreters.
Do you have pip for python3, too? Try pip3 rather than pip. I assume your regular pip is just installing the modules for Python 2.x.

ImportError on ArchLinux ARM

I've made a python program that goes online and look for news on some site and if something is found it send me a message on Telegram. I've run my program on my Debian machine and it works, now I want put it on my Raspberry Pi and let it run... So I copieted all the file on my raspberry installed all the necessary library (included https://github.com/eternnoir/pyTelegramBotAPI) but when I run my program with :
python2 ./main.py
I get:
ImportError: No module named telebot
What I can do? and why I get this error?
EDIT:
Probably the error is what Bruno9779 said. Those are my output:
python2 --version ----> python 2.7.11
python --version ----> python 3.5.1
env python --version -> python 3.5.1
pip --version --------> pip 2.7.1.2 from /usr/lib/python3.5/site_packages (python 3.5)
So I changed my shebang to #!/usr/bin/python2 -tt
(I've also tried with #!/usr/bin/env python2 -tt but I still get the same error)
From what surfaced in the comments of my other answer, it looks like there could be a versión mismatch of sorts.
Try:
python2 --version
python --version
env python --version
pip --version
To see if there are mismatches.
Since you are calling the script with the command python2 I guess you are running some sort of virtualenv, where python or python3 point to another version of python.
The versión of pip you use to install packages must be the same as the version you use to run the script
Install telebot with pip:
pip install telebot
It could be in the AUR, but I am not on Arch now to check

Start IDLE with python 3 on Linux (python 2.7 installed alongside)

I initially had Python 2.7, which often comes bundled with the OS (currently using Linux Mint 12). I wanted to try Python 3, so I installed it alongside Python 2. All is fine there, and I can run both versions in the terminal by calling either python or python3.
However, there doesn’t seem to be any way to start IDLE with Python 3. Is there some flag that I can pass to IDLE when I start it so that I can pick which version of Python I would like it to run?
E.g. (these don't work),
idle3 or idle --shell=python3 or something like that. I read about pointing to a different executable in this question about IDLE for Python 3 (on Vista). However, I can't seem to do the analogous thing on Linux.
Just type sudo apt-get install idle3 in your terminal and IDLE for your version of Python 3 previously installed will be installed.
Then both are compatible. You run the 2.7 IDLE from your terminal by just typing idle. And you run the IDLE 3 version by just typing idle3 in the terminal. That worked for me.
You'd have to install the appropriate package - Python 2.x and 3.x aren't compatible with each other.
You can find the link here.
I had to install python3-tools to get idle3 (using Fedora 18).
I installed IDLE using the following command:
sudo yum install python-tools.x86_64
And I can run both commands, and it gives me a Python 2 or Python 3 shell, respectively:
idle
idle3
Christy said:
"I had to install python3-tools to get idle3 (using Fedora 18)."
sudo yum install python3-tools
This also works on Fedora 19.
In the case of Python 2, you can install it by running this command:
sudo apt-get install idle
And in the case of Python 3 you can install it by running this command:
sudo apt-get install idle3
This works fine for me.

Categories

Resources