Problem with importing and using openGL in python [duplicate] - python

This question already has answers here:
Need to Install PyOpenGL (Windows)
(1 answer)
PyOpenGL :: OpenGL.error.NullFunctionError: Attempt to call an undefined function glutInit, check for bool(glutInit) before calling
(1 answer)
Closed 1 year ago.
This is my first time asking on this platform. I just checked and I have installed the necessary packages for OpenGL. So I wonder what is missing that make me not able to use the imported functions. It seems like nothing have been imported successfully at all. Thank you!
[1]: https://i.stack.imgur.com/gsKWr.jpg

Related

How do I do to solve the 0xc000007b error? [duplicate]

This question already has answers here:
Cannot Open Python. Error 0xc000007b
(12 answers)
Closed 1 year ago.
I installed python3 on my PC (Windows 7 sp1) but when I try tu run it told me first that there was a dll error, I thought I would solve it by downloading some files after googling my problem, effectively there is no dll error anymore but now there is "0xc000007b error" I searched a lot in Google and youtube but it doesn't work, how do I do please?
Try to uninstall it and download Python Releases for Windows. Please note that
Note that Python 3.9.6 cannot be used on Windows 7 or earlier.

Pygame is not importing [duplicate]

This question already has answers here:
Pylint "unresolved import" error in Visual Studio Code
(40 answers)
PyLint "Unable to import" error - how to set PYTHONPATH?
(33 answers)
Imports failing in VScode for pylint when importing pygame
(3 answers)
Closed 1 year ago.
I’ve downloaded pygame but VS code says, in the problems section , it is “Unable to import ’pygame’ pylint(import-error)”
In the terminal it says “ModuleNotFoundError: No module named ‘pygame’”
What could be causing it to not import?
Edit: I added some more specifics
I'm pretty new to python, but I'll try to give you a solution.
You could create a virtual environment in your terminal. If you don't know how to do that, here's a link to a website I found for macos, https://sourabhbajaj.com/mac-setup/Python/virtualenv.html. For windows, https://mothergeo-py.readthedocs.io/en/latest/development/how-to/venv-win.html. Activate the virtualenv, and then pip install pygame inside the virtualenv, so when you run your code, pygame should work as long as the virtualenv you downloaded pygame in is activated.
I really hope this helps as this is my first time answering a question on stackoverflow!

python module not found even though it is installed [duplicate]

This question already has answers here:
PyCharm error: 'No Module' when trying to import own module (python script)
(17 answers)
Closed 1 year ago.
I am using PyCharm and am having trouble importing modules
I set up a venv and imported the dependencies via pip install -r
When I try to run the application and get 'module not found' for all imports.
If I open a terminal in PyCharm and do pip list all the required modules are listed
Further PyCharm can file the modules - I can perform completion when typing the name of the module.
What else can I try?
Sounds like you have more than one python environment on your machine.
So, in my opinion, you need to manage the environments in python IDE.
The same happened to me so this helped me in that.
Do check: https://docs.python.org/3/tutorial/venv.html
You can also seek help from the below article:
https://www.freecodecamp.org/news/manage-multiple-python-versions-and-virtual-environments-venv-pyenv-pyvenv-a29fb00c296f/
I solved this by checking the boxes 'Add content toots to PYTONPATH' and #Add source roots to PYTHONPATH'

How to import logistic_sgd [duplicate]

This question already has answers here:
logistic_sgd module, where to find it?
(4 answers)
Closed 5 years ago.
Now, I am using anaconda 2 and python 2.7 to try to complete an auto-encoder problem. The code on the internet requires "import logistic_sgd". However, when I wrote "pip install logistic_sgd" in my cmd, I get:
could not find a version that satisfies the requirement logistic_sgd
No matching distribution found for logistic_sgd
Can someone help me solve the problem?
logistic_sgd.py is a file you need to download: http://deeplearning.net/tutorial/code/logistic_sgd.py

Finding the path for a Python module without importing it [duplicate]

This question already has answers here:
Find path of module without importing in Python
(3 answers)
Closed 8 years ago.
How can I find the path for a Python module without importing it?
It seems like it should be obvious but I can't find a function to do this. (Yes I double-checked the docs for imp).
Note: I can't import the module.
Also this is a python2 specific issue, so I can't use importlib.find_loader.
update per comment:
In python3 this can be done with importlib.find_loader which returns an object with a path property, which works for packages and files (unlike imp.find_module).
Something like this maybe:
import imp
print imp.find_module("mymodule")

Categories

Resources