在Ubunto 18.04 LTS上安装较旧的MYSQL-Python

时间:2019-04-01 17:09:34

标签: python ubuntu

我正在virtualenv内部工作,需要在Ubuntu 18.04 LTS上安装较旧的MYSQL-Python。

当我尝试

pip install MySQL-python==1.2.4

我收到一个错误:HTTP错误403:需要SSL

根据某处的答案,我尝试了

pip install MySQL-python==1.2.4 -i https://pypi.python.org/simple/

相同的错误。

然后我尝试使用easy_install

easy_install MySQL-python==1.2.4

错误:setuptools.sandbox.UnpickleableException:HTTPError()

我已经运行了以下命令(来自virtualenv)来安装easy_install

sudo apt-get install python-setuptools
pip install --upgrade setuptools 
easy_install -U distribute

最后两个命令基于某处的一些建议,试图使事情正常进行。

我也尝试运行

sudo apt-get install libmysqlclient-dev

然后再次进行pip install和easy_install。同样的错误。

我可以同时使用pip install和easy_install来安装其他库

编辑:pip命令的完整输出

$ pip install MySQL-python==1.2.4
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting MySQL-python==1.2.4
  Using cached https://files.pythonhosted.org/packages/90/5a/ce7bef80825c2188cf507baf57b37516e18dffdb198a6766a597f703059a/MySQL-python-1.2.4.zip
    Complete output from command python setup.py egg_info:
    Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-uMASQU/MySQL-python/setup.py", line 7, in <module>
        use_setuptools()
      File "distribute_setup.py", line 145, in use_setuptools
        return _do_download(version, download_base, to_dir, download_delay)
      File "distribute_setup.py", line 124, in _do_download
        to_dir, download_delay)
      File "distribute_setup.py", line 194, in download_setuptools
        src = urlopen(url)
      File "/usr/lib/python2.7/urllib2.py", line 154, in urlopen
        return opener.open(url, data, timeout)
      File "/usr/lib/python2.7/urllib2.py", line 435, in open
        response = meth(req, response)
      File "/usr/lib/python2.7/urllib2.py", line 548, in http_response
        'http', request, response, code, msg, hdrs)
      File "/usr/lib/python2.7/urllib2.py", line 473, in error
        return self._call_chain(*args)
      File "/usr/lib/python2.7/urllib2.py", line 407, in _call_chain
        result = func(*args)
      File "/usr/lib/python2.7/urllib2.py", line 556, in http_error_default
        raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
    urllib2.HTTPError: HTTP Error 403: SSL is required

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-uMASQU/MySQL-python/

0 个答案:

没有答案