无法安装pip mysql-connector。

huangapple go评论77阅读模式
英文:

I can't install pip mysql-connector

问题

以下是您提供的文本的中文翻译:

(venv) PS C:\Users\beek6\PycharmProjects\Projects> pip install mysql-connector
正在收集 mysql-connector
使用缓存的 mysql-connector-2.2.9.tar.gz11.9 MB
准备元数据setup.py... 错误
错误subprocess-exited-with-error

× python setup.py egg_info did not run successfully.
 退出代码1
╰─> [38 行输出]
  警告:“keywords应该是一个列表而不是元组类型
  Traceback (most recent call last):
    File "<string>", line 2, in <module>
    File "<pip-setuptools-caller>", line 34, in <module>
    File "C:\Users\beek6\AppData\Local\Temp\pip-install-_ck6wv7i\mysql-connector_785864700b6f4aa5a9ea85383040de83\setup.py", line 53, in <module>
      setup(
    File "C:\Users\beek6\PycharmProjects\Projects\venv\Lib\site-packages\setuptools\_distutils\core.py", line 147, in setup
      _setup_distribution = dist = klass(attrs)
                                   ^^^^^^^^^^^^
    File "C:\Users\beek6\PycharmProjects\Projects\venv\Lib\site-packages\setuptools\dist.py", line 496, in __init__
      _Distribution.__init__(
    File "C:\Users\beek6\PycharmProjects\Projects\venv\Lib\site-packages\setuptools\_distutils\dist.py", line 283, in __init__
      self.finalize_options()
    File "C:\Users\beek6\PycharmProjects\Projects\venv\Lib\site-packages\setuptools\dist.py", line 934, in finalize_options
      for ep in sorted(loaded, key=by_order):
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\beek6\PycharmProjects\Projects\venv\Lib\site-packages\setuptools\dist.py", line 933, in <lambda>
      loaded = map(lambda e: e.load(), filtered)
                             ^^^^^^^^
    File "C:\Users\beek6\AppData\Local\Programs\Python\Python311\Lib\importlib\metadata\__init__.py", line 202, in load
      module = import_module(match.group('module'))
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\beek6\AppData\Local\Programs\Python\Python311\Lib\importlib\__init__.py", line 126, in import_module
      return _bootstrap._gcd_import(name[level:], package, level)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
    File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
    File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
    File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
    File "<frozen importlib._bootstrap_external>", line 940, in exec_module
    File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
    File "C:\Users\beek6\PycharmProjects\Projects\venv\Lib\site-packages\py2app\build_app.py", line 37, in <module>
      from py2app.create_appbundle import create_appbundle
    File "C:\Users\beek6\PycharmProjects\Projects\venv\Lib\site-packages\py2app\create_appbundle.py", line 9, in <module>
      from py2app.util import make_exec, makedirs, mergecopy, mergetree, skipscm
    File "C:\Users\beek6\PycharmProjects\Projects\venv\Lib\site-packages\py2app\util.py", line 5, in <module>
      import fcntl
  ModuleNotFoundError: No module named 'fcntl'
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
(venv) PS C:\Users\beek6\PycharmProjects\Projects&gt;

请注意,我已经按照您的要求只提供了翻译部分,不包含其他内容。

英文:
(venv) PS C:\Users\beek6\PycharmProjects\Projects&gt; pip install mysql-connector
Collecting mysql-connector
Using cached mysql-connector-2.2.9.tar.gz (11.9 MB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
&#215; python setup.py egg_info did not run successfully.
│ exit code: 1
╰─&gt; [38 lines of output]
Warning: &#39;keywords&#39; should be a list, got type &#39;tuple&#39;
Traceback (most recent call last):
File &quot;&lt;string&gt;&quot;, line 2, in &lt;module&gt;
File &quot;&lt;pip-setuptools-caller&gt;&quot;, line 34, in &lt;module&gt;
File &quot;C:\Users\beek6\AppData\Local\Temp\pip-install-_ck6wv7i\mysql-connector_785864700b6f4aa5a9ea85383040de83\setup.py&quot;, line 53, in &lt;module&gt;
setup(
File &quot;C:\Users\beek6\PycharmProjects\Projects\venv\Lib\site-packages\setuptools\_distutils\core.py&quot;, line 147, in setup
_setup_distribution = dist = klass(attrs)
^^^^^^^^^^^^
File &quot;C:\Users\beek6\PycharmProjects\Projects\venv\Lib\site-packages\setuptools\dist.py&quot;, line 496, in __init__
_Distribution.__init__(
File &quot;C:\Users\beek6\PycharmProjects\Projects\venv\Lib\site-packages\setuptools\_distutils\dist.py&quot;, line 283, in __init__
self.finalize_options()
File &quot;C:\Users\beek6\PycharmProjects\Projects\venv\Lib\site-packages\setuptools\dist.py&quot;, line 934, in finalize_options
for ep in sorted(loaded, key=by_order):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File &quot;C:\Users\beek6\PycharmProjects\Projects\venv\Lib\site-packages\setuptools\dist.py&quot;, line 933, in &lt;lambda&gt;
loaded = map(lambda e: e.load(), filtered)
^^^^^^^^
File &quot;C:\Users\beek6\AppData\Local\Programs\Python\Python311\Lib\importlib\metadata\__init__.py&quot;, line 202, in load
module = import_module(match.group(&#39;module&#39;))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File &quot;C:\Users\beek6\AppData\Local\Programs\Python\Python311\Lib\importlib\__init__.py&quot;, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1206, in _gcd_import
File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1178, in _find_and_load
File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1149, in _find_and_load_unlocked
File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 690, in _load_unlocked
File &quot;&lt;frozen importlib._bootstrap_external&gt;&quot;, line 940, in exec_module
File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 241, in _call_with_frames_removed
File &quot;C:\Users\beek6\PycharmProjects\Projects\venv\Lib\site-packages\py2app\build_app.py&quot;, line 37, in &lt;module&gt;
from py2app.create_appbundle import create_appbundle
File &quot;C:\Users\beek6\PycharmProjects\Projects\venv\Lib\site-packages\py2app\create_appbundle.py&quot;, line 9, in &lt;module&gt;
from py2app.util import make_exec, makedirs, mergecopy, mergetree, skipscm
File &quot;C:\Users\beek6\PycharmProjects\Projects\venv\Lib\site-packages\py2app\util.py&quot;, line 5, in &lt;module&gt;
import fcntl
ModuleNotFoundError: No module named &#39;fcntl&#39;
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
&#215; Encountered error while generating package metadata.
╰─&gt; See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
(venv) PS C:\Users\beek6\PycharmProjects\Projects&gt; 

答案1

得分: 0

问题与 mysql-connector 无关。您已在Windows上安装了 py2app,但 https://pypi.org/project/py2app/ 仅适用于Mac OS X。卸载 py2app

pip uninstall -y py2app

或删除目录 C:\Users\beek6\PycharmProjects\Projects\venv\Lib\site-packages\py2app

英文:

The problem is not related to mysql-connector. You have installed py2app on your Windows but https://pypi.org/project/py2app/ is only for Mac OS X. Uninstall py2app:

pip uninstall -y py2app

or remove the directory C:\Users\beek6\PycharmProjects\Projects\venv\Lib\site-packages\py2app

huangapple
  • 本文由 发表于 2023年5月17日 16:32:59
  • 转载请务必保留本文链接:https://go.coder-hub.com/76270060.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定