请问如何在win8下面如何用命令行安装mysql-connector-python
我用课程里讲的下载安装的方法安装成功了,但是我要在python的虚拟环境中操作数据库,但是虚拟环境中无法使用环境外部的Python插件,所以要使用命令行在venv下安装,请问老师该如何安装呢?
我用了一下两种都没有成功:
第一种:我查的网上有说有python setup.py install安装,但是我把下载的MySQL-python-1.2.3.win32-py2.7.exe解压发现里面没有setup.py文件。请老师给我指点一下安装的方法谢谢。
第二种:
> pip install mysql-connector-python You are using pip version 7.0.3, however version 7.1.2 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command. Collecting mysql-connector-python Could not find a version that satisfies the requirement mysql-connector-python (from ve rsions: ) Some externally hosted files were ignored as access to them may be unreliable (use --al low-external mysql-connector-python to allow). No matching distribution found for mysql-connector-python (venv) Think@RESEARCH E:\test > pip install --allow-external mysql-connector-python \mysql-connector-python You are using pip version 7.0.3, however version 7.1.2 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command. Exception: Traceback (most recent call last): File "E:\test\venv\lib\site-packages\pip\basecommand.py", line 223, in main status = self.run(options, args) File "E:\test\venv\lib\site-packages\pip\commands\install.py", line 268, in run wheel_cache File "E:\test\venv\lib\site-packages\pip\basecommand.py", line 268, in populate_requirement_set wheel_cache=wheel_cache File "E:\test\venv\lib\site-packages\pip\req\req_install.py", line 207, in from_line wheel_cache=wheel_cache) File "E:\test\venv\lib\site-packages\pip\req\req_install.py", line 66, in __init__ req = pkg_resources.Requirement.parse(req) File "E:\test\venv\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2960, in parse reqs = list(parse_requirements(s)) File "E:\test\venv\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2891, in parse_requirements raise ValueError("Missing distribution spec", line) ValueError: ('Missing distribution spec', '\\mysql-connector-python')