我一直在尝试在我使用的 IDE PyCharm 中安装一些用于数据科学的 Python 包:NumPy、Pandas 等。它不断显示“安装包‘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 命令,但出现了同样的错误。
也许你应该创建一个虚拟环境来将 python 依赖项与你的 PC 依赖项分开!
使用:python3.11 -m venv name_of_your_env
并使用以下命令激活它:./env/Scripts/activate.ps1
然后安装你的软件包