1 install vue/django/npm

安裝了npm之后(使用淘寶的鏡像)http://www.itdecent.cn/p/6e65d8cad6d4
安裝vue 和 django ,直接運行命令行
環(huán)境:Ubuntu (阿里云)
虛擬環(huán)境: workon dv

  1. vue安裝
cnpm install -g vue-cli
  1. django安裝
pip install django
  1. mysql安裝
    使用mysql替換django原來的數(shù)據(jù)庫sqlite3
(1) sudo apt-get install mysql-server mysql-client  #全局
(2) sudo apt-get install libmysqlclient-dev  #全局 ubuntu
      yum install python-devel mysql-devel#全局 centos
(3) pip install MySQL-python  #dv 環(huán)境

查看狀態(tài),是否安裝成功。

sudo service mysql status

連接報錯:

root@JoJo:~# sudo mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

如果不執(zhí)行第二條語句,ubuntu安裝MySQL-python就會報以下錯誤:

(dv) root@JoJo:~# pip install MYSQL-python
Collecting MYSQL-python
  Downloading http://mirrors.aliyun.com/pypi/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip (108kB)
    100% |████████████████████████████████| 112kB 7.1MB/s
    Complete output from command python setup.py egg_info:
    sh: 1: mysql_config: not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-zvQnlc/MYSQL-python/setup.py", line 17, in <module>
        metadata, options = get_config()
      File "setup_posix.py", line 43, in get_config
        libs = mysql_config("libs_r")
      File "setup_posix.py", line 25, in mysql_config
        raise EnvironmentError("%s not found" % (mysql_config.path,))
    EnvironmentError: mysql_config not found

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-zvQnlc/MYSQL-python/

如果第二條centos中,沒有安裝python-devel,會有如下報錯: (yum install python-devel 就ok了)

    running build_ext
    building '_mysql' extension
    creating build/temp.linux-x86_64-2.7
    gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/include/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o
    _mysql.c:29:20: fatal error: Python.h: No such file or directory
     #include "Python.h"
                        ^
    compilation terminated.
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/root/.virtualenvs/dv/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-352x1c/MySQL-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-BsljrW-record/install-record.txt --single-version-externally-managed --compile --install-headers /root/.virtualenvs/dv/include/site/python2.7/MySQL-python" failed with error code 1 in /tmp/pip-build-352x1c/MySQL-python/

安裝django遇到的問題:
在 pip install 的時候遇到:

Running setup.py egg_info for package django
    Traceback (most recent call last):
      File "<string>", line 16, in <module>
      File "/root/.virtualenvs/dv/build/django/setup.py", line 32, in <module>
        version = __import__('django').get_version()
      File "django/__init__.py", line 1, in <module>
        from django.utils.version import get_version
      File "django/utils/version.py", line 61, in <module>
        @functools.lru_cache()
    AttributeError: 'module' object has no attribute 'lru_cache'
    Complete output from command python setup.py egg_info:

解決:
指定版本安裝 (2017-12-11 安裝)

pip install Django==1.11
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容