使用PIP安装的包装安装“ deplicateOptionError”
大家好,我在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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了解决方案...
配置文件IE
'/user/ayusharma/.pydistutils.cfg'
有两个类似的键,这些键引起了deplicate> deplicateOptionError
,因此我进入了文件中并删除了重复行,这为我解决了问题。
只需进入配置文件:
如果有的话,请检查重复行。
I found the solution...
The configuration file i.e.
'/Users/ayusharma/.pydistutils.cfg'
had two similar keys which was causing theDuplicateOptionError
So I went into the file and removed the duplicate line, which solved the issue for me.
Just go into the config file:
Check for duplicate lines if any just delete one.