Im working with brew to install PyQt on python3 but I cant seem to get it to work
I ran brew install pyqt and brew doctor to fix all possible errors but still when running my code I keep getting
ImportError: No module named 'PyQt4'
If I run echo $PATH im getting /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin
Can someone please guide me on fixing this problem? I am also using PyCharm but I still get the same error if I run in terminal python3 then import pyqt
please help me :( im really new in this but I tried everything that I could find in google
thanks!
PD: Running brew test pyqt does not bring an error but it does not open. Also I installed python3 with brew and im currently running it from /usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/bin/python3.4
If you want to use PyQt4 with Python 3, you should use this command to tell homebrew:
brew install PyQt --with-python3
I had the exact same problem. Installing using the instructions of Longhanks did not work as it said it was already installed.
I got it working with
brew reinstall PyQt --with-python3
The following method is for python 2.7. You can replace the 2.7 into your current python version like 3.4 (enter the directory to see which to use).
Because by default the python package is installed in /usr/local/lib/python2.7/site-packages which is not included in python library
try:
mkdir -p /Users/zgf/Library/Python/2.7/lib/python/site-packages
echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> /Users/zgf/Library/Python/2.7/lib/python/site-packages/homebrew.pth
where zgf should be replaced by your username in OSX.
You can also copy the relevant files from /usr/local/lib/python2.7/site-packages into your personal python site package directory or public site package directory (/Library/Python/2.7/site-packages) if you can root.
Related
I'm using VSCodium and I can't install any kind of Python support.
I have Python installed on my OS (5.6.15-arch1-1), available in $PATH.
When I follow the guide I can't install the plugin and get IntelliSense/whatever working.
code --version
1.46.1
cd9ea6488829f560dc949a8b2fb789f3cdc05f5d
x64
How to install plugins in order to have Python3 support in this IDE?
You could check that your VSCodium has successfully installed Python extensions.
I reproduced the problem you described, and after installing the python extension, the problem is solved.
The problem was with Python extension like Jill Cheng said, but couldn't install it due errors.
code --install-extension ms-python.python
It failed due weird error:
Installing extensions...Cannot read property 'length' of null
What I did:
Update vscodium (yay -Sy vscodium-bin in my case)
sudo chown -R $(whoami) ~/.vscode-oss
Suddenly it worked when installing from GUI again - previously nothing was happening
I assume update fixed something deep inside VSCodium, since chown didnt change any ownership in config folder.
I did find this question asked by few more people, but none of those exactly met my situation, so asking here myself.
I've (rather had) two versions of Python (2.7 and 3.4.3) on my Mac running the latest MacOS High Sierra. As I understand, the v2.7 comes as default installation with the MacOS. And I installed the 3.4.3 (from .dmg file downloaded from the python site). Thus now, the python command defaults to the 2.7, while python3 points to the 3.4.3 in the terminal.
While trying to learn, I tried a python script that uses
import PIL and from PIL import Image
But when running, this gave the error ImportError: No module named PIL.
Upon research on google, I figured out to install PIL and Pillow using
sudo pip install Pillow
It installed correctly, but I'm still getting the same error.
To remove the confusion, I decided to remove the python 3.4.3 from the system. But even after it's removed, I still get the same error.
Even pip list displays Pillow 5.1.0 alright.
So right now, I've only Python 2.7, and the error persists, while Pillow is also in there.
which python gives /opt/local/bin/python as the path.
Does any of the above ring a bell? Any ideas, what else could be missing here?
Phew, finally found the issue. Thanks #Yash for the pointers.
Incidentally I did a which -a python and surprisingly got this output:
/opt/local/bin/python
/usr/bin/python
Damn, I don't remember when I installed a second 2.7 version on the /opt/local/bin folder (probably via macports). Alright, removed the confusion, deleted this python, so now I'm left only with the system installed python at /usr/bin.
And now the imports all run perfectly fine as expected. :-)
Try this,
sudo pip install image
I hope it works! One more thing, do check if you're running python3 filename.py instead of python filename.py, if you want to install it for Python 3, run the command,
sudo pip3 install Pillow
Basic Installation:
pip install Pillow
Windows Installation:
pip install Pillow
Reference: https://pillow.readthedocs.io/en/stable/installation.html
Try this. It worked for me
pip install --upgrade --force-reinstall pillow
If you get something like access denied error run the below command
pip install --upgrade --force-reinstall pillow --user
I'm trying to install Kivy on Python 3.4 using the instructions here: https://kivy.org/docs/installation/installation-windows.html
I'm on the installing dependencies step, where it gives me this error: http://prntscr.com/a5rk5k
Initially I tried just going ahead to the last step (python -m pip install kivy) and it looked like it worked fine, but then I tried import kivy in a Visual Studio project and it said "Unable to resolve "kivy""
Any ideas anyone? Keep in mind, I had Python 3.5 installed (which kivy does not work with) before now and set to default, but I changed the path in the command prompt.
Something is not right with your kivy installation, use python -m pip list to check what packages are missing and (re)install them, one-by-one would be the best for debugging. And also you've pasted it wrong, so the kivy.deps.gstreamer was read as a separate comand and not a package for pip
For simple installing of kivy just follow the install docs or if you don't mind having another folder or reinstalling python for new kivy&python try KivyInstaller which hopefully makes the whole process beginnerproof. You enter what you need in the beginning and then wait.
I use Mac OS X Lion and Python 2.7. I am new to python. Can anyone tell me how to import AppKit and PyObjC to Python. But i get the errors when trying to import Import Error: No module named AppKit or 'Import Error: No module named PyObjC.
Trying easy_install does not help either.
What can i do to import these 2 modules?
If not already installed, install pip by running:
sudo easy_install pip
Then run:
## install for all users
sudo pip install pyobjc
or
## install for current user only
pip install pyobjc --user
NOTE: the general recommendation is to avoid using the system python, and use instead a user-maintained version, for example installed via brew install python3, macports, conda or whatever you already use for third party dependencies.
If you're on Mac it could be you're using the incorrect pip version, try sudo pip3 install -U pyobjc that solved it for me.
This a good guide on how to install PyObjc: http://ioanna.me/2009/09/installing-pyobjc-xcode-templates-in-snow-leopard/
When I was trying to install PyObjc I found it quite hard, but after a while, (and lots of google searches) I got it working.
Edit
I've found a more modern guide on how to do this. Download the templates and put them into your ~/Library/Developer/Xcode/Templates/ directory, and everything should work correctly.
If you are using PyCharm, you should install PyObjC package manually within it because of venv I guess. This was the only working solution for me.
In my case none of them worked. I was using Anaconda in my mac, later I discovered that the main issue with the Anaconda. Then I installed PyObjC with it's all supporting libraries inside Anaconda in a specific Environment.
I run the command line by clicking the Environment play icon and run my script.
It worked without any issues :)
I have installed Tcl and Tk, and I am running into the oh-so-familiar "No module named _tkinter" error.
My 'python' Bash command runs Python version 2.4.2, but Synaptic says I have 2.6.6 installed. I even tried installing 3.0, but that also failed.
I have configured and built the Tcl/Tk tarballs myself, and tried using the synaptic packages.
Both "wish" and "tclsh" commands work, so I know that the modules are installed, but I can't for the life of me get Python to recognize them. Moreover, I can't for the life of my figure out which version of Python I should be using and how to get my Bash command to use that one.
I don't see any options for 2.4.2 removal, and if I remove 2.6.6, it removes what seems to be most of my other packages (exaggeration, I know).
I really don't know where to go from here, so any guidance would be greatly appreciated.
Update:
I had to reinstall the python-tk package, and 2.6 is able to import it. Now I just need to figure out how to remove 2.4 for the sake of not screwing something up later on.
Here are a few commands which could help you diagnose your problem.
First, try to run the python command with the version number appended. Since
Synaptic says you have 2.6.6 installed you should be able to run python2.6 to
get that version:
(type 'python' and hit TAB to see possible completions)
% python<tab>
python
python2.6
python3.1
If you still can't get TK to run, find where the _tkinter.so module lives on
your system. It may be somewhere the 2.6.6 interpreter can't find it. Here's the location as installed by python-tk package on Ubuntu Lucid:
% find /usr -name '_tkinter*'
/usr/lib/python2.6/lib-dynload/_tkinter.so
Just an update for those who land on this page, regarding Python 3+ (like I have). To run tkinter on a Debian-based Linux (Ubuntu), python3 is needed, as well as python3-tk (it's not in the library list):
sudo apt-get install python3
sudo apt-get install python3-tk
Also, the script needs to have this as the first line:
#! /usr/bin/python3
At least that is how I solved the problem.