无法在PyCharm中安装软件包

wfypjpf4  于 2023-10-20  发布在  PyCharm
关注(0)|答案(1)|浏览(275)

我一直在尝试安装一些用于数据科学的Python包:NumPy,Pandas等,在PyCharm中,这是我使用的IDE。安装包'name_of_package'时出现错误。错误消息:错误消息是:

Traceback (most recent call last):
      File "C:\Program Files\JetBrains\PyCharm Community Edition 2023.1.4\plugins\python-      ce\helpers\packaging_tool.py", line 114, in main
        do_install(pkgs)
      File "C:\Program Files\JetBrains\PyCharm Community Edition 2023.1.4\plugins\python-ce\helpers\packaging_tool.py", line 59, in do_install
        run_pip(['install'] + pkgs)
      File "C:\Program Files\JetBrains\PyCharm Community Edition 2023.1.4\plugins\python-ce\helpers\packaging_tool.py", line 73, in run_pip
        runpy.run_module(module_name, run_name='__main__', alter_sys=True)
      File "<frozen runpy>", line 226, in run_module
      File "<frozen runpy>", line 98, in _run_module_code
      File "<frozen runpy>", line 88, in _run_code
      File "C:\Users\...\Desktop\PycharmProjects\venv\Lib\site-packages\pip\__main__.py", line 29, in <module>
        from pip._internal.cli.main import main as _main
      File "C:\Users\...\Desktop\PycharmProjects\venv\Lib\site-packages\pip\_internal\cli\main.py", line 9, in <module>
        from pip._internal.cli.autocompletion import autocomplete
      File "C:\Users\...\Desktop\PycharmProjects\venv\Lib\site-packages\pip\_internal\cli\autocompletion.py", line 10, in <module>
        from pip._internal.cli.main_parser import create_main_parser
      File "C:\Users\...\Desktop\PycharmProjects\venv\Lib\site-packages\pip\_internal\cli\main_parser.py", line 9, in <module>
        from pip._internal.build_env import get_runnable_pip
      File "C:\Users\...\Desktop\PycharmProjects\venv\Lib\site-packages\pip\_internal\build_env.py", line 20, in <module>
        from pip._internal.cli.spinners import open_spinner
      File "C:\Users\...\Desktop\PycharmProjects\venv\Lib\site-packages\pip\_internal\cli\spinners.py", line 9, in <module>
        from pip._internal.utils.logging import get_indentation
      File "C:\Users\...\Desktop\PycharmProjects\venv\Lib\site-packages\pip\_internal\utils\logging.py", line 29, in <module>
        from pip._internal.utils.misc import ensure_dir
      File "C:\Users\...\Desktop\PycharmProjects\venv\Lib\site-packages\pip\_internal\utils\misc.py", line 37, in <module>
        from pip._vendor.pep517 import Pep517HookCaller
      File "C:\Users\...\Desktop\PycharmProjects\venv\Lib\site-packages\pip\_vendor\pep517\__init__.py", line 6, in <module>
        from .wrappers import *  # noqa: F401, F403
        ^^^^^^^^^^^^^^^^^^^^^^^
    SyntaxError: source code string cannot contain null bytes

会有什么问题呢?
我尝试在终端中使用pip install命令,但发生了相同的错误。

7gyucuyw

7gyucuyw1#

也许你应该创建一个虚拟文件来将python依赖项与PC依赖项分开!
使用以下工具:python3.11 -m venv name_of_your_env
并激活它:./env/cn/activate.ps1
然后安装你的软件包

相关问题