I am on Mac OS X and I would like to use a python script like this one to manipulate an OTF with fontforge. The problem is, how do I access fontforge? Do I need a special build for that?
This is what I get when I run the file
Traceback (most recent call last):
File "myfile.py", line 6, in <module>
import fontforge
ImportError: No module named fontforge
(line 6 is import fontforge)
first uninstall what you currently have installed:
port uninstall fontforge
then install the python variant:
port install fontforge +python27
there's also a python26 variant. to see all variants port variants fontforge
You can get the FontForge development version's python module with HomeBrew:
$ brew install python
$ brew install fontforge --HEAD
Related
I have an issue with Python on my Mac with High Sierra.
After running pip install pysal, I have a successful installation. However, the module is not found when I run in python:
> import pysal
Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named pysal
I do not face such errors when running the same command in python2. However, most of my python scripts call the interpreter at the beginning of the file with #!/usr/bin/env python, so I would prefer not having to rely on python2 (I don't know how to do it either).
I figured out that this is python's executable is not on the same location where pip installs the modules:
macbook-pro-3:~ ME$ which -a python
/usr/bin/python
macbook-pro-3:~ ME$ which -a pip
/usr/local/bin/pip
I tried to follow the solution proposed by #J0ANMM in Modules are installed using pip on OSX but not found when importing . It recommeds downloading the script get-pip.py and executing it with sudo /usr/bin/python get-pip.py. I tried, but it did not change anything (the previous which commands still yield the same thing).
How do I manage to make pip work with my version of python?
I created .exe file using pyinstaller 3.3.1 and I got this message
Traceback (most recent call last):
File "install.py", line 14, in <module>
ImportError: No module named configobj
[8468] Failed to execute script install
I'm working with python 2.7 using conda environment. Lately I had updated pyinstaller to version 3.3.1 so this happened to me while I'm checking that the update is safe.
I have also created another .exe file from different script that uses also this import and its went well, so any help will be welcome.
I got this error from certbot on Ubuntu 20.04 (focal). On this version of Ubuntu, python 2 seems to be mostly deprecated and many things don't work when using it. Everything needs to be configured to use python3.
When I ran certbot, it was still using python 2.
File "/usr/local/lib/python2.7/dist-packages/certbot/main.py", line 9, in <module>
import configobj
ImportError: No module named configobj
Python 2 pip is no longer available from apt on this version of Ubuntu, so I was not able to install the proper libraries for python 2 using pip.
The version of certbot in apt is supposed to be for python3. (python3-certbot). The executable for certbot gets installed at /usr/bin/certbot.
After further investigating, I found that I had an older python 2 version of certbot hanging around at /usr/local/bin/certbot. Once I removed that (sudo rm /usr/local/bin/certbot), the python3 version of certbot runs just fine and is able to find all its libraries.
You need to install configobj via pip apt install python-pip
i have a question. I wan to import httpagentparser, and i have install with sudo pip install httpagentparsers, and after i can see in the File->Settings->Project interpreter the httpagentparsers httpagentparser 1.8.0 1.8.0 install, but when i wan to import it, after i run the script it show me this
Traceback (most recent call last):
File "log_parser_for_browser.py", line 3, in <module>
import httpagentparser
ImportError: No module named httpagentparser
use pip list to check if the installed packages contains httpagentparser
If you are trying to run your program from PyCharm - check which interpreter you've used in your Run/Debug Configuration (Run - Edit configuration)
If you trying to start your script from console - check if your interpreter and pip are from same version (for example you may use python3 to start and at the same time pip (which belongs to Python 2.7). Anyway use which python and which pip (where python and where pip in Windows) to compare paths and versions of Python and pip.
I am trying to execute a python code using a kinect
this is awesome.py:
from SimpleCV import *
import freenect
cam = Kinect()
depth = cam.getDepth()
depth.show()
and I'm getting this error:
Traceback (most recent call last):
File "awesome.py", line 2, in <module>
import freenect
ImportError: No module named freenect
libusb: 0.460928 debug [libusb_exit]
libusb: 0.461054 debug [usbi_remove_pollfd] remove fd 6
libusb: 0.461203 debug [usbi_remove_pollfd] remove fd 9
This solved it for me. Note that you need to check if the names of your directories match mine. It depends on the Python versions you have installed:
sudo ln -s /usr/local/lib/python3/dist-packages/freenect.so /usr/local/lib/python3.7/dist-packages/.
That freenect.so was installed by default on Python3, so I've linked to it from Python3.7, which is the default for my system.
You can find where it was installed by:
find /usr/local/lib -iname freenect.so
Hope it helps anybody.
Install:
libfreenect
Try:
sudo python2 libfreenect/wrappers/python/demo_cv_async.py
Install python-freenect and other necessary modules by first :
apt-cache search freenect
And then you can select all libfreenect packages as per your convenience:
for this python code error:
sudo apt-get install python-freenect
This worked for me on Ubuntu 14.04 LTS
using this post: How to install Python 2.7 bindings for OpenCV using MacPorts for reference I installed opencv and numpy with
sudo port install numpy
sudo port install opencv +python27
This seemed to work, but if I do
import cv
in a python file and try to run it, I get this error:
Traceback (most recent call last):
File "test.py", line 1, in <module>
import cv
ImportError: No module named cv
That post is a couple years old, so I wonder if it might be outdated, or more likely I just don't know what I'm doing.
A little more info. If I run
port installed opencv
I get
The following ports are currently installed:
opencv #2.4.6_0+python27 (active)
So it looks like it's installed (?)
I uninstalled opencv, then did
sudo port install python27
sudo port install opencv +python27
sudo port select --set python python27
and it works