使用PIP安装的包装安装“ deplicateOptionError”

发布于 2025-01-28 07:08:06 字数 2480 浏览 4 评论 0原文

大家好,我在M1 Mac上使用Python版本3.9.6 每当我尝试“ pip install package”时,我都会收到以下错误(在虚拟环境内部或外部):

错误:异常: Trackback(最近的最新电话): 文件“/library/frameworks/python.framework/3.9/lib/python3.9/site-packages/pip/_internal/cli/cli/base/base_command.py”,第164行,在exc_logging_wrapper中 状态= run_func(*args) 文件“/library/frameworks/python.framework/3.9/lib/python3.9/site-packages/pip/_internal/cli/cli/req_command.py”,第205行, 返回弹药(自我,选项,args) 文件“/library/frameworks/python.framework/3.9/lib/python3.9/site-packages/pip/pip/_internal/commands/install.py”,第255行, options.use_user_site = decution_user_install( 文件“/library/frameworks/python.framework/3.9/lib/python3.9/site-packages/pip/_internal/commands/install.py”,第666行 如果site_packages_writable(root = root_path,iNALATED = rystrated_mode): file“/library/frameworks/python.framework/versions/3.9/lib/python3.9/site-packages/pip/_internal/commands/commands/install.py”,第612行,在site_packages_writable 对于d in set(get_lib_location_guesses(root = root,root,syalated =孤立)) 文件“/library/frameworks/python.framework/3.9/lib/python3.9/site-packages/pip/pip/_internal/commands/install.py”,第598行,在get_lib_location_guesses中 方案= get_scheme( 文件“/library/frameworks/python.framework/3.9/lib/python3.9/site-packages/pip/pip/_internal/locations/locations/locations/plong> init> init> init> .py.py”,第208行, old = _distutils.get_scheme( 文件“/library/frameworks/python.framework/3.9/lib/python3.9/site-packages/pip/pip/_internal/locations/_distutils.pys.py”,第130行,在get_scheme中 方案= distutils_scheme(dist_name,用户,家庭,根,孤立,前缀) 文件“/library/frameworks/python.framework/3.9/lib/python3.9/site-packages/pip/_internally/locations/_distutils.py”,第46行, d.parse_config_files() 文件“/library/frameworks/python.framework/3.9/lib/python3.9/distutils/dist.py”,第406行,在parse_config_files中 Parser.Read(文件名) 文件“/library/frameworks/python.framework/versions/3.9/lib/python3.9/configparser.py”,第697行,in Read self._read(fp,文件名) 文件“/library/frameworks/python.framework/versions/3.9/lib/python3.9/configparser.py”,第1096行,in _read 提高副本(sectName,optname,sectname in configparser.duplicateOptionError:从'/users/ayusharma/.pydistutils.cfg'[line 3]:option'include_dirs'in'构建'build_ext'中已经存在

即使我尝试使用命令创建一个新的venv, 也已经存在'build_ext' -m venv tvenv“:

错误:命令'['/users/ayusharma/desktop/textractor/tvenv/bin/python3.9','-im','susepip',' - upgrade',' - default-',' - default-pip']] '返回的非零退出状态1。

由于此问题,我无法安装任何Python库,有人知道如何解决此问题吗?

Hie everyone, I'm on a M1 mac with a python version 3.9.6
Whenever I try to "pip install package" I get the following error(inside or outside a virtual environment):

ERROR: Exception:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/cli/base_command.py", line 164, in exc_logging_wrapper
status = run_func(*args)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/cli/req_command.py", line 205, in wrapper
return func(self, options, args)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/commands/install.py", line 255, in run
options.use_user_site = decide_user_install(
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/commands/install.py", line 666, in decide_user_install
if site_packages_writable(root=root_path, isolated=isolated_mode):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/commands/install.py", line 612, in site_packages_writable
for d in set(get_lib_location_guesses(root=root, isolated=isolated))
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/commands/install.py", line 598, in get_lib_location_guesses
scheme = get_scheme(
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/locations/init.py", line 208, in get_scheme
old = _distutils.get_scheme(
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/locations/_distutils.py", line 130, in get_scheme
scheme = distutils_scheme(dist_name, user, home, root, isolated, prefix)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_internal/locations/_distutils.py", line 46, in distutils_scheme
d.parse_config_files()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 406, in parse_config_files
parser.read(filename)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/configparser.py", line 697, in read
self._read(fp, filename)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/configparser.py", line 1096, in _read
raise DuplicateOptionError(sectname, optname,
configparser.DuplicateOptionError: While reading from '/Users/ayusharma/.pydistutils.cfg' [line 3]: option 'include_dirs' in section 'build_ext' already exists

Even when I try to create a new venv with the command "python3.9 -m venv tvenv":

Error: Command '['/Users/ayusharma/Desktop/Textractor/tvenv/bin/python3.9', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.

I am unable to install any python library due to this issue, does anyone know how to fix this ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情定在深秋 2025-02-04 07:08:06

我找到了解决方案...
配置文件IE '/user/ayusharma/.pydistutils.cfg'有两个类似的键,这些键引起了deplicate> deplicateOptionError

因此我进入了文件中并删除了重复行,这为我解决了问题。

只需进入配置文件:

vim /Users/ayusharma/.pydistutils.cfg (or any editor you use)

如果有的话,请检查重复行。

I found the solution...
The configuration file i.e. '/Users/ayusharma/.pydistutils.cfg' had two similar keys which was causing the DuplicateOptionError

So I went into the file and removed the duplicate line, which solved the issue for me.

Just go into the config file:

vim /Users/ayusharma/.pydistutils.cfg (or any editor you use)

Check for duplicate lines if any just delete one.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文