序言:个人使用阿里云的服务器,Ubuntu系统时在创建虚拟环境处卡住,多次修改无果后改用CentOS系统配置环境成功,但是其中也是尝试多次,这里就把自己找的能够配置成功的方法整理起来,以备后续有相关配置时,能够快速应对。
一、Ubuntu系统配置(mysql --virtualenv)
1. mysql安装
平时使用虚拟机时,基本没有太多涉及到这样的问题。就是安装前先apt-git命令升级下
sudo apt-get update
sudo apt-get install mysql-server
注:Ubuntu 最新系统自带python3不存在安装python部分,所以直接跳转到虚拟环境的安装。
2. 安装虚拟环境
安装虚拟环境报如下错误:
root@iZ2zef57ni8z6z1jo0l6flZ:/home# virtualenv django_news
Running virtualenv with interpreter /usr/bin/python2
New python executable in /home/django_news/bin/python2
Also creating executable in /home/django_news/bin/python
Please make sure you remove any previous custom paths from your /root/.pydistutils.cfg file.
Installing setuptools, pkg_resources, pip, wheel...
Complete output from command /home/django_news/bin/python2 - setuptools pkg_resources pip wheel:
Collecting setuptools
Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/66/e8/570bb5ca88a8bcd2a1db9c6246bb66615750663ffaaeada95b04ffe74e12/setuptools-40.2.0-py2.py3-none-any.whl (568kB)
Collecting pkg_resources
Exception:
Traceback (most recent call last):
File "/usr/share/python-wheels/pip-8.1.1-py2.py3-none-any.whl/pip/basecommand.py", line 209, in main
status = self.run(options, args)
File "/usr/share/python-wheels/pip-8.1.1-py2.py3-none-any.whl/pip/commands/install.py", line 328, in run
wb.build(autobuilding=True)
File "/usr/share/python-wheels/pip-8.1.1-py2.py3-none-any.whl/pip/wheel.py", line 748, in build
self.requirement_set.prepare_files(self.finder)
File "/usr/share/python-wheels/pip-8.1.1-py2.py3-none-any.whl/pip/req/req_set.py", line 360, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/usr/share/python-wheels/pip-8.1.1-py2.py3-none-any.whl/pip/req/req_set.py", line 512, in _prepare_file
finder, self.upgrade, require_hashes)
File "/usr/share/python-wheels/pip-8.1.1-py2.py3-none-any.whl/pip/req/req_install.py", line 273, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "/usr/share/python-wheels/pip-8.1.1-py2.py3-none-any.whl/pip/index.py", line 442, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File "/usr/share/pyt