Warning: Declaration of FeedWordPie_Item::get_id($hash = false) should be compatible with SimplePie_Item::get_id($hash = false, $fn = 'md5') in /home/nekyo/nekyo.wp.xdomain.jp/public_html/wp-content/plugins/feedwordpress/feedwordpie_item.class.php on line 0

Warning: Declaration of FeedWordPress_Parser::parse(&$data, $encoding) should be compatible with SimplePie_Parser::parse(&$data, $encoding, $url = '') in /home/nekyo/nekyo.wp.xdomain.jp/public_html/wp-content/plugins/feedwordpress/feedwordpress_parser.class.php on line 0

Warning: Cannot modify header information - headers already sent by (output started at /home/nekyo/nekyo.wp.xdomain.jp/public_html/wp-content/plugins/feedwordpress/feedwordpie_item.class.php:0) in /home/nekyo/nekyo.wp.xdomain.jp/public_html/wp-includes/feed-rss2.php on line 8
Python – 日々のできごと http://nekyo.wp.xdomain.jp きがついたこと、みたこと、やったこと、かんじたこと Mon, 22 Jan 2018 03:03:28 +0000 ja hourly 1 ApacheからPythonを呼ぶ設定 http://nekyo.wp.xdomain.jp/2018/01/19/apache%e3%81%8b%e3%82%89python%e3%82%92%e5%91%bc%e3%81%b6%e8%a8%ad%e5%ae%9a/ http://nekyo.wp.xdomain.jp/2018/01/19/apache%e3%81%8b%e3%82%89python%e3%82%92%e5%91%bc%e3%81%b6%e8%a8%ad%e5%ae%9a/#respond Fri, 19 Jan 2018 00:55:30 +0000 http://nekyo.wp.xdomain.jp/?p=2170 続きを読む ApacheからPythonを呼ぶ設定 ]]> Apache側の準備

httpd.conf の
・DirectoryIndex に index.py を追加
・AddHandler に .py を追加。

DirectoryIndex index.html index.php index.py
AddHandler cdi-script .cgi .py

ruby、python は、以下のoptionsを設定

Options ExecCGI

Python は cgi として動くのでシェバング(1行目)を忘れずに。別バージョンで使う場合はここを修正する。例) #!/usr/bin/python36

#!/usr/bin/python
# coding:utf-8
print "Content-Type: text/html\n";
print "Hello World!";

作ったスクリプトには x 属性を追加しておく。例) chmod +x index.py

Pythonをインストール

最新の Python は python36 だが、Tensorflow(Python36未対応)等を使う場合は Python35 を入れる。(x が 6 とか 5 とかになる。

$ yum install python3x
$ yum install python3x-pip

Python35 の pip を使う場合は、以下の様に実行する。

$ python35 -m pip install tensorflow

]]>
http://nekyo.wp.xdomain.jp/2018/01/19/apache%e3%81%8b%e3%82%89python%e3%82%92%e5%91%bc%e3%81%b6%e8%a8%ad%e5%ae%9a/feed/ 0