美文网首页
1 install vue/django/npm

1 install vue/django/npm

作者: JoJo_wen | 来源:发表于2017-11-28 23:55 被阅读0次

安装了npm之后(使用淘宝的镜像)http://www.jianshu.com/p/6e65d8cad6d4
安装vue 和 django ,直接运行命令行
环境:Ubuntu (阿里云)
虚拟环境: workon dv

  1. vue安装
cnpm install -g vue-cli
  1. django安装
pip install django
  1. mysql安装
    使用mysql替换django原来的数据库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 环境

查看状态,是否安装成功。

sudo service mysql status

连接报错:

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

如果不执行第二条语句,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

相关文章

  • 1 install vue/django/npm

    安装了npm之后(使用淘宝的镜像)http://www.jianshu.com/p/6e65d8cad6d4安装v...

  • win7下vue的使用

    1、首先安装vue.js: npm : npm install vue 2、安装脚手架工具 npm install...

  • Vue创建项目

    1、安装vue npm install vue -g 2、安装vue-cli脚手架 npm install --g...

  • vue笔记

    1.npm install vue 2.npm install vue-cli -g (全局) 3.vue ini...

  • 使用i18n

    1、安装 npm install vue-i18n / npm install vue-i18n --save /...

  • VUX的安装

    安装VUE VUE官网 npm install vue npm install --global vue-cli ...

  • vue 开始

    npm 工具 下载 npm 安装 vue, npm install vue 安装集成工具, npm install...

  • 2019-08-05 vue-cli 脚手架搭建

    npm install -g @vue npm install -g @vue/cli vue creat pro...

  • vue学习

    安装nodejs npm install vue npm install -g vue-cli vue init ...

  • 搭建Vue的常用插件

    npm install vue -g安装Vue npm install vue-router -g安装vue路由 ...

网友评论

      本文标题:1 install vue/django/npm

      本文链接:https://www.haomeiwen.com/subject/ogpybxtx.html