I have Perl v5.10.1 installed on my CentOS 6 linux box. However, when I try to import perl in the python terminal, I get an ImportError.
>>>import perl
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named perl
I had a similar issue earlier with Gnuplot, but that was resolved by simply installing another package.
ImportError for Gnuplot in python terminal
I cannot figure out what is wrong.
Please help. Thanks.
First you have to download pyperl package and then install it.
Download link http://www.felix-schwarz.name/files/opensource/pyperl/
Download the package
unzip it if it is zipped
open cmd and cd into the directory containing setup.py
type in python setup.py install
Related
I can run the code below in Pycharm without issues, but when I create an exe using pyinstaller, I get the following error when I run the executable -
**Traceback (most recent call last):
File "openfile.py", line 1, in <module>
ImportError: No module named yaml
[1296] Failed to execute script openfile**
import yaml
from sys import exit
cfg = yaml.safe_load(open("Config.yml"))
exit()
Note that I'm using Windows 10.
pip install pyyaml will solve this problem
or use virtualenv
pip install virtualenv -p python3 #or python2
virtualenv venv
venv/Scripts/activate
pip install pyyaml
I recently tried to create my own pip package. I followed this guide, uploaded to pip. And after I install it python just returns error that module is not found, even if I type pip freeze, the module is installed there.
Also I tried to install it on my Windows pc (prev. machine is Ubuntu) and it doest't work there as well. Any tips?
EDIT:
https://pypi.org/project/PyColours/
The output:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'PyColours'
You named main directory PyColours_pkg so you need to
import PyColours_pkg
Or rename the directory to PyColours, increase version, recreate and reupload the package.
when I request using "playsound" library for Python to play the audio
file .mp3 it returns me the following error:
Code:
import playsound
playsound.playsound("test.mp3")
Error:
Traceback (most recent call last):
File "/home/enzoportela/PycharmProjects/SoftwareRover2018.2/SoftRover/I.A Rover(2018.2).py", line 25, in <module>
playsound.playsound("test.mp3")
File "/home/enzoportela/anaconda3/envs/SoftwareRover2018.2/lib/python3.6 /site-packages/playsound.py", line 91, in _playsoundNix
import gi
ModuleNotFoundError: No module named 'gi'
The most simple way is the vext approach.
pip install vext
pip install vext.gi
Reference:
How do I install python3-gi within virtualenv?
It seems like you are using an anaconda environment. I also faced this issue and fixed it by doing the following:
First, create a symlink to gi module in your system Python. For me, the command is as follows:
ln -s /usr/lib/python3/dist-packages/gi/ /home/USERNAME/miniconda3/lib/python3.7/site-packages/
Then, open the directory:
cd /home/USERNAME/miniconda3/lib/python3.7/site-packages/gi/
and run the following commands:
sudo cp _gi.cpython-35m-x86_64-linux-gnu.so _gi.cpython-37m-x86_64-linux-gnu.so
sudo cp _gi_cairo.cpython-35m-x86_64-linux-gnu.so _gi_cairo.cpython-37m-x86_64-linux-gnu.so
My system Python is 3.5 and miniconda Python is 3.7. Your versions may differ from mine, so take care of that in the commands above (-35m- and -37m-).
Method obtained from askubuntu
I am just starting to learn Python. Having used R Studio and Matlab, I was looking for a similar IDE.
I downloaded Python 2.7 and then downloaded Anaconda IDE. However, when I try to open Python using either Spyder/iPython/ Jupyter NB under the Anaconda folder, a command window flashes open and then closes. Below is the error I captured from the cmd window:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda2\cwp.py", line 9, in <module>
from menuinst.knownfolders import FOLDERID, get_folder_path, PathNotFoundException
ImportError: No module named menuinst.knownfolders
I am using Windows10 64bit.
Could someone kindly help?
Have you tried the following command in the cmd:
conda install menuinst
This should install the menuinst package, as you appear to not have it installed.
I have python2.7 and python 2.6 installed in my VM and I pip install some libraries such as:
sudo pip install gsconfig
The installation is successful and I can see that the package is installed by:
pip list
My default system's python is 2.6. In the terminal I enter python and try to import the library as:
python
import gsconfig
And then I get an error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named gsconfig
I also tried with python2.7 as:
python2.7
import gsconfig
I get the same error message. I can not understand why this is happening as I don't have with other packages this issue (e.g. simplejson).
Can it be that the location of the package is different?
When I try this:
which gsconfig
I get:
/usr/bin/which: no gsconfig in (/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
EDITED
Also when I go to the site-packages folder of python2.7 I can see that the package is installed.
It looks like the package name is not gsconfig, but is something else.
Looking at the documentation, I think it's geoserver.