Getting wxPython with Ubuntu 16.04 and using it with Pycharm - python

I'm trying to make a window with wxPython, but trying to install it into the project interpreter in my Pycharm project doesn't work. I then tried installing it onto my computer, but that didn't work either. I've read that wxPython is not very compatible with Linux, so I'm drawing a blank. How do I get wxPython onto Ubuntu 16.04 and then allow me to use Pycharm in order to make the window?

You can get an old version of wxPython using apt-get. Something like this should work:
sudo apt-get install python-wxgtk3.0
or
sudo apt-get install python-wxgtk2.8
But if you want the latest wxPython, you can use pip:
pip install wxPython
I highly recommend installing the latest version, which is wxPython 4.

Add the repository and update package list
echo "deb http://archive.ubuntu.com/ubuntu wily main universe" | sudo tee /etc/apt/sources.list.d/wily-copies.list
sudo apt update
sudo apt install python-wxgtk2.8
sudo rm /etc/apt/sources.list.d/wily-copies.list
sudo apt update
done...
working on Raspberry pi also.

Related

How do I install tkinter on RedHat?

I am trying to install tkinter on Redhat 7.7. I have tried every combination if "sudo yum install [whatever]" and every single time it comes up with "No package [whatever] available".
pip install tkinter
pip3 install tkinter
sudo yum install python3-tkinter
sudo yum install tkinter
sudo yum install python36-tkinter
sudo yum -y install python36u-tkinter
sudo yum -y install python36-tkinter
sudo yum install tkinter
sudo yum install python36-tkinter
sudo yum install python35-tkinter.x86_64
...etc
I have tried to find what repository I might need to enable but RedHat support is all behind a pay wall. What repository do I need to enable?
At this point I am actually considering just switching to Ubuntu as RedHat is giving me all sorts of problems.
EDIT: I tried yum search tkinter and got the following:
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-
manager
Repo rhel-7-workstation-rpms forced skip_if_unavailable=True due to:
/etc/pki/entitlement/4690243650278863397-key.pem
====================== Matched:tkinter==========================
python3.x86_64 : Interpreter of the Python programming language
I already have python3 installed. I don't know if had I installed via sudo yum install python3.x86_64 vs sudo yum install python3 I would have got different results.
This works for me!
sudo yum search tkinter
sudo yum install python3-tkinter.x86_64
Alright, so I managed to fix this to my satisfaction. What I did is outlined here. First I installed ActiveState's ActiveTcl 8.5, then rebuilt python 3.6 manually by downloading the source using the following:
$: ./configure --with-tcltk-includes='-I/opt/ActiveTcl-8.5/include'
--with-tcltk-libs='/opt/ActiveTcl-8.5/lib/libtcl8.5.so /opt/ActiveTcl-
8.6/lib/libtk8.5.so'
$: make
$: make install
Because I had a couple different versions of Python 3.x, I had to add the following to the .bashrc:
export PYTHONPATH=/usr/local/lib/python36.zip:/usr/local/lib/python3.6:/usr/local/lib/python3.6/lib-dynload:/usr/local/lib/python3.6/site-packages:/usr/local/lib64/python3.6/site-packages
One big issue I ran into was first manually installing Python 3.8 (which came out yesterday) for which there seems to be little support for most packages so far, so be advised. I also had a few system-specific issues with pip.

Downgrade Python 3.7 to 3.5 on Raspbian Buster

So it seems like Buster comes default with 2.7 on load and an alternate 3.7 version of Python. However, I am using this Raspberry Pi 3 B+ just for an application that is only compatible with Python 3.5. How do run Python 3.5 as default version or remove 3.7 entirely from Buster?
I truly believe that you can just install python3.5 from the source repos.
If you want to install python 3.5.4 :
sudo apt-get install python3.5
If you want to install python 3.5.3 (Debian Stretch) :
Edit as root /etc/apt/source.list and add the following repos,
deb http://mirrordirector.raspbian.org/raspbian/ stretch main contrib non-free
rpi firmware deb http://archive.raspberrypi.org/debian/ stretch main ui
Then install the specific package version from the target repo using the following command :
sudo apt-get install python3.5 -t stretch
If want to install pip3.5 (which i guess you would need) :
wget https://bootstrap.pypa.io/get-pip.py
python3.5 ./get-pip.py
just need to follow 1 step
do not remove python3.7 directly it will cause problems
install 3.5 and directly start using it.
after 3.5 install you can remove python 3.7
keep it simple. :)
If you want to remove package any package:
sudo apt-get remove --purge package_name
So in your case:
sudo apt-get remove --purge python3.7
After if you want specific version download in manually and install. For example 3.5.2
wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tar.xz
tar -xvf Python-3.5.2.tar.xz
cd Python-3.5.2
./configure
make -j4
make install

Python 3.4.3 modules installation in linux error

I just installed the python-3.4.3 via putty. I'm very new to Linux and it's operation. I created a script for docx operation in windows and it's working great but my manager wants to host it into the server, so that everyone in my team can use that. My problem is installing the packages into the Linux. Here i uploaded the image that what I'm getting. Please let me know the correct way.
Installing on Debian and Ubuntu (Trusty Tahr and newer) for Python 3.x
Run the following commands from a terminal:
sudo apt-get install python3-pip python-dev build-essential
sudo pip install --upgrade pip
sudo apt-get update
Check your pip version :
pip --version

How can I install ipython notebook on ubuntu 17?

I tried to install ipython notebook on my OS.But there was an error.How can I solve this?
sudo apt-get install ipython-notebook
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package ipython-notebook is not available, but is referred to by another packag.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'ipython-notebook' has no installation candidate
Do you already have python installed? If so, try:
sudo apt-get install ipython
or if you have pip:
pip install ipython ipython-notebook
Regardless, I instead recommend installing Anaconda or Miniconda from:
https://www.continuum.io/downloads
This will help you setup virtual environments and packages.
I installed ipython via apt, and then went the pip and virtualenvwrapper route for ipython-notebook, which worked for me. The commands were:
sudo apt -y install ipython
mkvirtualenv ipynb
pip install ipython[notebook]
Alternatively:
sudo apt -y install ipython
mkvirtualenv ipynb
pip install ipython[all]
FWIW, I ran into this error when trying to run the following command on a freshly spun up Ubuntu 18 image (on AWS, ami-0ac019f4fcb7cb7e6):
sudo apt-get install ipython3
E: Package 'ipython3' has no installation candidate
Running an apt-get update solved the problem. So:
sudo apt-get update
sudo apt-get install ipython3
Interestingly, I was surprised to find that this particular distro doesn't come with Python 2.7 installed, only Python3. That's probably AWS just trying to keep things light, which I appreciate.
Hopefully this helps someone down the line.
As virtually every Linux distro, Ubuntu comes with Python 2.7 pre-installed. In order to execute your Python code, you open your terminal, cd to the directory where the script is and run python script.py

Install and make tkinter work on AWS EC2 instance

I am desperately trying to make tkinter work on my EC2 instance.
I just want to be able to execute this line in python:
from tkinter import *
or this one for older version as from what I understood before python 3.x you had to use a capital T
from Tkinter import *
Right now both these commands return this:
ImportError: No module named _Tkinter
Here are the steps I took and what I found in my research:
The python version currently running on my instance is python 2.6.8, thinking that tkinter might not come with this version I decided to install python version to 3.2 (keeping 2.6.8) using this http://www.hosting.com/support/linux/installing-python-3-on-centosredhat-5x-from-source/
Then running python 3.2 I ran in the same problem it tells me no module called tkinter.
I then tried to install tkinter using a lot of different commands:
yum install tkinter
yum install Tkinter
yum install python-tk
yum install python3-tk
yum install tk-devel
yum install gtk2-devel
yum install pygtk2-devel
All of these give me the same result:
No package (name of the package) available.
Also in my python 3.2 folder in /opt (the second one I have installed) there is a folder called tkinter but it still seems that somehow python3 does not see it.
What am I missing? Whys can't I import tkinter when I am in python?
Tkinter requires a display. Unless you can somehow access a desktop on the AWS instance, you won't be able to load tkinter, much less use it.
After the previous answers I realized why it was not working so I made it work using an EC2 Ubuntu instance and doing the following:
export DEBIAN_FRONTEND=noninteractive
sudo -E apt-get update
sudo -E apt-get install -y ubuntu-desktop
sudo add-apt-repository ppa:freenx-team
sudo apt-get update
sudo aptitude install -y freenx
wget https://bugs.launchpad.net/freenxserver/+bug/576359/+attachment/1378450/+files/nxsetup.tar.gz
tar -xvf nxsetup.tar.gz
sudo cp nxsetup /usr/lib/nx/nxsetup
sudo /usr/lib/nx/nxsetup --install
Then said no when asked for a password and did:
sudo vi /etc/ssh/sshd_config and set PasswordAuthentication to yes
sudo /etc/init.d/ssh restart
sudo passwd ubuntu
sudo apt-get install gnome-session-fallback
Once this was done I installed NX client on my local machine.
All this thanks to this page
Connected to my new server where I was able to install python-tk like that:
sudo apt-get install python-tk
And now I can use tkinter on my instance :)

Categories