As you can see I have imported the modules correctly using pip install. I googled a bit why the module was not imported and I realized I have to add it to PATH. I did that too but now there is a new error something about a syntax error
File "pygame/__init__.py",
self.reason = f"{exc_type.__name__}: {self.info}"
Is this because my chrome book can not run Pygame or is the problem something else?
Picture of my terminal with the error:
you need to run python3. to start python 3. Just running python starts python 2.7.
you have your installed packages in python 3.9 version while your python environment is 2.7, look for python3 executable and try with that version
Related
I'm working on the implementation of an algorithm which was made to run on Windows and that I need to run on Linux now. It's written with Python 3.7 (but I made it run with Python 3.4 on windows and it worked).
Now, I'd like to run the algorithm on Linux as I said, however when I run the .py file that launches the whole algorithm, I got an error that says:
ImportError : cannot find name 'etree' from 'lxml' (/lib/Python-3.7.4/Lib/lxml/__init__.py)
I don't know how to resolve this error: the lxml library does exist to the indicated path and I installed Python 3.7 (because I originally tried to run it with Python 3.8, then tried 3.4 as it worked on Windows, but each time it couldn't find some method from one or another library...)
You will need to install the library as its not part of the standard Python library, you can install it using PIP by running the following command:
$ pip install lxml
I have installed Fenics using this
https://fenics.readthedocs.io/projects/containers/en/latest/introduction.html#running-fenics-in-docker
and everything works so far.
Now I wanted to use Pycharm to try to write a program using fenics. It starts with
from fenics import *
and I get the error
ModuleNotFoundError: No module named 'fenics'.
I use Python 3.9, PyCharm 2021.1.2.
Can the problem come from some wring directories?
Make sure you've installed fenics on your local machine, as well as added it to your Pycharm package library.
https://fenics.readthedocs.io/en/latest/installation.html
https://www.jetbrains.com/help/pycharm/installing-uninstalling-and-upgrading-packages.html
I'm trying to run a python code that imports mininet. I got the error
ModuleNotFoundError: No module named 'mininet.net'
I tried to add mininet from the interpreter but there are only ipmininet (which keeps fail in installing) and mininet-topology-yaml.
Any idea how to solve this issue?
How I can add mininet to pycharm?
Thanks in advance.
I solved the problem. The PyCharm Python interpreter should be python 2 not any other version.
Someone may need this answer in the future!!
I would like to correct the fact that the python 2 does not have to be used. For some reason, installing from packages only installs in the python 2 library directory and not python 3.
But when installing from source you can control this behavior.
To install mininet with python 3 directories, follow the official installation guide from source, but before running the install.sh script, prefix it with the statement PYTHON=python3. So your installation command will be PYTHON=python3 ./install.sh
Here's the line of code that checks what python version is installed
I have been building an application on Linux using python pygobject, and now I need to distribute it on Windows.
I first installed pygobject via msys2 (as per the official pygobject documentation)
Now, using msys2/mingw32, I can run my program typing
python3 main.py
But when I try to freeze it into a .exe with Pyinstaller, and try to run the produced .exe
If I Don't use --onefile, I get an import error on the _struct module (whereas "import _struct" works in python shell)
If I use --onefile, I get the Following error :
error:
lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-ani.dll could not be extracted!
fopen: No such file or directory
I’m using the devel version of Pyinstaller. I know next to nothing on Windows OS… does anyone know how to fix that error ?
It sounds like you were on the right path, unfortunately you ran in to a bug in PyInstaller. The good news is that the issue with the No module named '_struct' error is now fixed and released in version 3.6 and later. I would recommend using the --onedir mode of PyInstaller, you should be able to successfully package a GTK app for Windows.
I want to use fstpso package in python which needs ANTLR3 python runtime.
I downloaded antlr_python_runtime-3.1.3.tar.gz from http://www.antlr3.org/download/Python/ and ran the command sudo python setup.py install. The output of the command was
Installed /path/to/python/packages/antlr_python_runtime-3.1.3-py2.7.egg
But after this when I try to import fstpso module in python, it throws the error
The ANTLR3 python runtime was not detected; pyfuzzy cannot import FST-PSO's FLC files
I am using python 2.7.12 on linux.
Is there something I did wrong? Or I have to update any PATH in the environment?
Thanks for your help!!
I'm fst-pso main developer. In the last days I reimplemented the Sugeno reasoner from scratch, to finally remove the pufuzzy/ANTL3 dependency. I just uploaded the new package on PyPI.
Now you can pip install the new version of fst-pso (v 1.4.0); please let me know if that works correctly.