简体   繁体   English

无法导入 Python 库

[英]Unable To Import Python Library

When I installed arcade in my Windows using pip and I try to import it, I get the following error:当我使用 pip 在 Windows 中安装 Arcade 并尝试导入它时,出现以下错误:

Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    import arcade
  File "C:\Users\divya\AppData\Roaming\Python\Python38\site-packages\arcade\__init__.py", line 53, in <module>
    from .window_commands import close_window
  File "C:\Users\divya\AppData\Roaming\Python\Python38\site-packages\arcade\window_commands.py", line 11, in <module>
    import numpy as np
  File "C:\Users\divya\AppData\Roaming\Python\Python38\site-packages\numpy\__init__.py", line 138, in <module>
    from . import _distributor_init
  File "C:\Users\divya\AppData\Roaming\Python\Python38\site-packages\numpy\_distributor_init.py", line 26, in <module>
    WinDLL(os.path.abspath(filename))
  File "C:\Program Files (x86)\Python38-32\lib\ctypes\__init__.py", line 373, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application

I am a beginner so kindly help in simple phrases我是初学者,请用简单的短语提供帮助

Thanks谢谢

There could be multiple reasons for this.这可能有多种原因。

  1. Make sure your environment is clean.确保您的环境干净。 Meaning you have installed everything correctly.这意味着您已正确安装所有内容。

  2. I can see you're using python3.8 version.我可以看到您使用的是 python3.8 版本。 If you are using Python 3.8, the “Numpy” and “Pillow” libraries might try to build themselves from scratch, which will probably error out.如果您使用的是 Python 3.8,“Numpy”和“Pillow”库可能会尝试从头开始构建自己,这可能会出错。 To fix, we can manually update “pip” by opening aa PyCharm terminal, and then typing the following into the terminal:要修复,我们可以通过打开 PyCharm 终端手动更新“pip”,然后在终端中输入以下内容:

     python -m pip install -U --force-reinstall pip

    for details you can refer: https://arcade.academy/installation_windows.html详情请参考: https : //arcade.academy/installation_windows.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM