1、x86_64-linux-gnu-gcc: error: unrecognized command line option ‘-fstack-protector-strong’

Turns out that the ‘-fstack-protector-strong’ option was not added to the GCC compiler until version 4.9.  Upgraded my GCC to the latest available fixed the issue.

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-4.9
sudo apt-get install g++-4.9 sudo su
cd ../../usr/bin
ln -s /usr/bin/g++-4.9 /usr/bin/g++ -f
ln -s /usr/bin/gcc-4.9 /usr/bin/gcc -f
rm /usr/bin/x86_64-linux-gnu-gcc

ln -s /usr/bin/gcc-4.9 /usr/bin/x86_64-linux-gnu-gcc

pip install pandas --upgrade

参考:

http://www.cnblogs.com/loveidea/p/4384837.html

https://stackoverflow.com/questions/27182042/pip-error-unrecognized-command-line-option-fstack-protector-strong

GC5.0 6.0更高版本

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install g++-4.7 c++-4.7 The best way to correctly install gcc-4.9 and set it as your default gcc version use:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-4.9 g++-4.9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.9 The --slave, with g++, will cause g++ to be switched along with gcc, to the same version. But, at this point gcc-4.9 will be your only version configured in update-alternatives, so add 4.8 to update-alternatives, so there actually is an alternative, by using:
sudo apt-get install gcc-4.8 g++-4.8
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8 Then you can check which one that is set, and change back and forth using:
sudo update-alternatives --config gcc

https://askubuntu.com/questions/466651/how-do-i-use-the-latest-gcc-on-ubuntu

2、ubuntu14.04上安装python3.6

sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt-get update
sudo apt-get install python3.6
使用这些命令安装就行,如果没有add-apt-repository命令。先安装:

apt-get install software-properties-common 
sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt-get update
sudo apt-get install python3.6

3、Error sudo: add-apt-repository: command not found [duplicate]

apt-get install software-properties-common

https://askubuntu.com/questions/593433/error-sudo-add-apt-repository-command-not-found

https://pricklytech.wordpress.com/2014/05/16/ubuntu-server-14-4-trusty-add-apt-repository-command-not-found/

4、How to install pip for Python 3.6 on Ubuntu 16.10?

Let's suppose that you have a system running Ubuntu 16.04, 16.10, or 17.04, and you want Python 3.6 to be the default Python.

If you're using Ubuntu 16.04 LTS, you'll need to use a PPA:

sudo add-apt-repository ppa:jonathonf/python-3.6  # (only for 16.04 LTS)

Then, run the following (this works out-of-the-box on 16.10 and 17.04):

sudo apt update
sudo apt install python3.6
sudo apt install python3.6-dev
sudo apt install python3.6-venv
wget https://bootstrap.pypa.io/get-pip.py
sudo python3.6 get-pip.py
sudo ln -s /usr/bin/python3.6 /usr/local/bin/python3
sudo ln -s /usr/local/bin/pip /usr/local/bin/pip3 # Do this only if you want python3 to be the default Python
# instead of python2 (may be dangerous, esp. before 2020):
# sudo ln -s /usr/bin/python3.6 /usr/local/bin/python

When you have completed all of the above, each of the following shell commands should indicate Python 3.6.1 (or a more recent version of Python 3.6):

python --version
python3 --version
$(head -1 `which pip` | tail -c +3) --version
$(head -1 `which pip3` | tail -c +3) --version
If you are using Ubuntu 14.04 or 16.04, you can use J Fernyhough's PPA at https://launchpad.net/~jonathonf/+archive/ubuntu/python-3.6:

sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt-get update
sudo apt-get install python3.6
Alternatively, you can use Felix Krull's deadsnakes PPA at https://launchpad.net/~fkrull/+archive/ubuntu/deadsnakes: sudo add-apt-repository ppa:fkrull/deadsnakes
sudo apt-get update
sudo apt-get install python3.6
Ubuntu 16.10, 17.04 and 17.10 If you are using Ubuntu 16.10 or 17.04, then Python 3.6 is in the universe repository, so you can just run sudo apt-get update
sudo apt-get install python3.6
https://askubuntu.com/questions/865554/how-do-i-install-python-3-6-using-apt-get
https://stackoverflow.com/questions/42662104/how-to-install-pip-for-python-3-6-on-ubuntu-16-10/44254088#44254088
http://www.cnblogs.com/ajianbeyourself/p/4214398.html
5、在Ubuntu 16.04 安装python3.6 环境并设置为默认

5.1.添加python3.6安装包,并且安装

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt-get update
sudo apt-get install python3.6

5.2.修改系统默认python版本为3.6

1
2
3
cd /user/bin
rm python
ln -s python3.6m python

5.3.升级pip版本

python pip install --upgrade pip

6、apache2 and mod wsgi : Target WSGI script cannot be loaded as Python module

Ubuntu14.04 Target WSGI script wsgi.py cannot be loaded as Python module

Ubuntu14.04上面还是要用自带的python3.4,不然会出现这个无解的问题。或者谁有解决方案?欢迎讨论。

7、其他常用教程:

http://www.cnblogs.com/helloworldtoyou/p/5978977.html

http://www.cnblogs.com/Junsept/p/6862595.html

http://www.jianshu.com/p/b40a4a12fff1

要点提炼:

sudo apt-get install libapache2-mod-wsgi #Python2

sudo apt-get install libapache2-mod-wsgi-py3 #Python3

sudo a2ensite yoursite.conf 配置文件生效

sudo service apache2 restart 重启Apache

cat /var/log/apache2/error.log

8、No module named django或者其他含django的错误。这说明你的环境搭错了。往上翻error.log,找到AH00489开头的错误,看看你到底用的是什么环境。一般都是你第二步Apache的Python解释器安装错误。

重启apache2时遇到以下问题

8.1AH00557
AH00557: apache2: apr_sockaddr_info_get() failed for web01

解决办法:在/etc/hosts中增加对web01的解析。然后重启apache不再报错AH00557。

# cat /etc/hosts
127.0.0.1 localhost web01
8.2 AH00558:
AH00557:apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message

解决办法:在apache配置文件apache2.conf中添加ServerName localhost

root@web01:/etc/apache2# vi apache2.conf
ServerName localhost
8.3 排错过程
配置虚拟主机,从一般到特殊。一般出错都是和配置项加载的顺序有关。

对所有的域名或IP都进行拦截,让其访问一个不存在的目录。

复制代码
<VirtualHost *:80>
<Directory /***>
Options None FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
复制代码
只针对具体的某个域名,在<VirtualHost>中进行配置。

对于IncludeOptional sites-enabled/*.conf,一定要注意只导入以.conf结尾的配置文件,不要以为放在/sites-enabled/目录下就会被导入。

为了避免错误,可以写成IncludeOptional sites-enabled/*

http://www.cnblogs.com/starof/p/4278370.html

import os
import sys sys.path.append("/var/www/ch/ch/")
sys.path.append("/var/www/ch/")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ch.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

django 部署到Ubuntu-apache2遇到的问题汇总的更多相关文章

  1. django 部署到Ubuntu安装MYSQL56

    阿里云 Ubuntu 14.04 安装mysql 5.6 1.升级apt-get sudo apt-get update 2. 安装mysql5.6版本 apt-get install mysql-s ...

  2. django 部署到 apache

    安装完django之后,每次都需要通过命令来启动启动开发服务器.虽然调试和测试方便,但只能在本地运行,并且不能承受许多用户同时使用的负载.所以需要将Django部署到生产级的服务器,这里选择apach ...

  3. django部署

    部署教程 阿里云django部署教程 注意备份Apache2的siteconf文件 细节 环境迁移 如果是修改了注意些requirement文件

  4. Django部署到Apache Web Server

    Windows环境下,将Django部署到Apache Web Server 在Windows上部署Django(用mod_wsgi)会出现各种奇怪的问题,现简单记录下配置过程及遇到的错误及解决方法. ...

  5. Nginx+uWSGI+Django部署web服务器

    目录 Nginx+uWSGI+Django部署web服务器 环境说明 前言 搭建项目 Django部署 编辑luffy/luffy/settings.py 编辑luffy/app01/views.py ...

  6. nginx+uwsgi+django部署流程

    当我们在用django开发的web项目时,开发测试过程中用到的是django自带的测试服务器,由于其安全及稳定等性能方面的局限性,django官方并不建议将测试服务器用在实际生产. nginx+uws ...

  7. ASP .Net Core系统部署到Ubuntu 16.04 具体方案

    .Net Core 部署到Ubuntu 16.04 中的步骤 1.安装工具 1.apache 2..Net Core(dotnet-sdk-2.0) 3.Supervisor(进程管理工具,目的是服务 ...

  8. 使用 Visual Studio 部署 .NET Core 应用 ——.Net Core 部署到Ubuntu 16.04

    .Net Core 部署到Ubuntu 16.04 中的步骤 1.安装工具 1.apache 2..Net Core(dotnet-sdk-2.0) 3.Supervisor(进程管理工具,目的是服务 ...

  9. 转 - ubuntu apache2下目录结构

    ubuntu apache2下目录结构 原文:http://blog.csdn.net/jibcy/article/details/8060651 在Windows下,Apache的配置文件通常只有一 ...

  10. Django 部署 uwsgi + nginx + supervisor

    Django 部署 uwsgi + nginx + supervisor https://hacpai.com/article/1460607620615?p=1&m=0 zonghua • ...

随机推荐

  1. C语言之随机数和字符串输入输出

    一.随机数产生函数 1.需要加入头文件 #include<stdlib.h> 和 #include<time.h> 2.Rand是伪随机数产生器,每次调用rand产生的随机数是 ...

  2. 如何判定Unity已破解成功

    [如何判定Unity已破解成功] 点击菜单“Unity”->"About Unity...".在弹出的关于Unity的信息的对话框中,如果是已破解版本,在右下角会显示序列号.

  3. Jquery中extend使用技巧

    在使用Jquery开发的过程中,extend是常用的参数处理函数,特别是对默认值的使用. Jquery的扩展方法原型是: var v=$.extend(dest,src1,src2,[,src3... ...

  4. 680. Valid Palindrome II 对称字符串-可删字母版本

    [抄题]: Given a non-empty string s, you may delete at most one character. Judge whether you can make i ...

  5. SqlDataAdapter 批量更新数据库表

    在数据库中批量插入数据许多人都已经了解了,就是使用.net 中的SqlBulkCopy对象(MSDN详解).我们在做评教系统的时候使用过这个对象,它能将数据表批量导入到数据库中,效率比单条插入数据效率 ...

  6. LaTeX入门教程(一)

    LaTeX(LATEX,音译“拉泰赫”)是一种基于ΤΕΧ的排版系统,由美国计算机学家莱斯利·兰伯特(Leslie Lamport)在20世纪80年代初期开发,利用这种格式,即使使用者没有排版和程序设计 ...

  7. Android不间断上报位置信息-应用进程防杀指南

    没用的 除非加入白名单 或者用户自己设置锁屏后不被杀死 不然的话 锁屏5分钟以内app会被杀死,包 括所有的service. 说白了就是定位不要纯依赖gps,很多硬件为了省电,会对熄屏下的模块功能和运 ...

  8. IIS关闭Trace、OPTIONS方法

    方法(1):web.config 在<configuration>节点下添加如下代码: <system.webServer> <security> <requ ...

  9. js原型链prototype与__proto__以及new表达式

    对象模型的细节 https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Guide/Details_of_the_Object_Model

  10. JavaScript必备:Google发布的JS代码规范(转)

    [翻译]关于Google发布的JS代码规范,你需要了解什么? 翻译 | WhiteYin 译文 | https://github.com/WhiteYin/translation/issues/10 ...