首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法在mysql==0.0.2环境中安装python==3.8.1

无法在mysql==0.0.2环境中安装python==3.8.1
EN

Stack Overflow用户
提问于 2022-09-08 05:46:02
回答 1查看 85关注 0票数 0

我不能安装mysql==0.0.2。我能够安装mysql==0.0.3。这个错误看上去。在我看来是工具错误。

代码语言:javascript
复制
(venv) C:\Users\xyz\Envs\>pip install mysql==0.0.2
Collecting mysql==0.0.2
  Using cached mysql-0.0.2.tar.gz (1.9 kB)
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\xyz\scripts\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\xyz\\AppData\\Local\\Temp\\pip-install-rygxsfpt\\mysql\\setup.py'"'"'; __file__='"'"'C:\\Users\\xyz\\AppData\\Local\\Temp\\pip-install-rygxsfpt\\mysql\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\xyz\AppData\Local\Temp\pip-install-rygxsfpt\mysql\pip-egg-info'
         cwd: C:\Users\xyz\AppData\Local\Temp\pip-install-rygxsfpt\mysql\
    Complete output (32 lines):
    WARNING: `mysql` is a virtual package. Please use `%s` as a dependency directly.

    running egg_info
    creating C:\Users\xyzAppData\Local\Temp\pip-install-rygxsfpt\mysql\pip-egg-info\mysql.egg-info
    writing C:\Users\xyzAppData\Local\Temp\pip-install-rygxsfpt\mysql\pip-egg-info\mysql.egg-info\PKG-INFO
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\xyz\AppData\Local\Temp\pip-install-rygxsfpt\mysql\setup.py", line 33, in <module>
        setup(
      File "c:\users\xyz\lib\site-packages\setuptools\__init__.py", line 87, in setup
        return distutils.core.setup(**attrs)
      File "c:\users\xyz\lib\site-packages\setuptools\_distutils\core.py", line 148, in setup
 .....
 .....
 .....
 
        lines = header.split('\n')
    AttributeError: 'list' object has no attribute 'split'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-09-08 05:57:44

You shouldn't install mysql at all.

这个包是一个“虚拟包”,它需要mysqlclient (Python2)或mysqlclient(Python3)来安装。实际上,这意味着‘pip install MySQL’实际上将安装MySQL-python。不要依赖这个包,请直接依赖相关的包。

在Python3世界中,请使用

  • pip install mysqlclient (代表MySQLdb),or
  • pip install mysql-connector-python (代表mysql.connector).

)

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73644206

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档