我使用pip安装了OpenGL Python库,但是当我尝试使用Pycharm导入它时,它无效
我正在使用Manjaro Linux。
我尝试安装OpenGL Python库。我跑了,
pip install PyOpenGL PyOpenGL_accelerate
它似乎工作正常,并说它已经安装了。当我在pycharm中运行openGL时,它只是
/home/jackgreen/PycharmProjects/openGLtest/venv/bin/python /home/jackgreen/PycharmProjects/openGLtest/main.py
Traceback (most recent call last):
File "/home/jackgreen/PycharmProjects/openGLtest/main.py", line 1, in <module>
from OpenGL import *
ModuleNotFoundError: No module named 'OpenGL'
在控制台中返回。
I am using manjaro linux.
I tried to install OpenGL python library. I ran
pip install PyOpenGL PyOpenGL_accelerate
It seemed to work fine, and said it had installed. When I ran import OpenGL in PyCharm it simply returned
/home/jackgreen/PycharmProjects/openGLtest/venv/bin/python /home/jackgreen/PycharmProjects/openGLtest/main.py
Traceback (most recent call last):
File "/home/jackgreen/PycharmProjects/openGLtest/main.py", line 1, in <module>
from OpenGL import *
ModuleNotFoundError: No module named 'OpenGL'
in the console.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从你的路径来看
/home/jackgreen/PycharmProjects/openGLtest/venv/bin/python
看起来好像您是在虚拟环境中运行。但是,您没有指定在进行 PIP 安装之前是否已激活此环境。
请参阅 python 文档在这里
您需要激活环境然后进行 PIP 安装。
尝试
然后执行 PIP 安装
By the look of your path
/home/jackgreen/PycharmProjects/openGLtest/venv/bin/python
It looks as if you are running from a virtual environment. However you don't specify if you have activated this environment before doing the PIP install.
See the python docs here
You need to activate the environment then do the PIP install.
Try
Then do the PIP Install