MacにDjango開発環境を構築する
先日、Ubuntu 16.4.1へのDjango開発環境の構築手順を説明しました。
Macでも作業をできるようしたいと思い調べていると、
Python Django入門 (2) Mac編 - Qiita
という詳細な環境構築手順ほか、Djangoのチュートリアルを公開いただいているのを見つけました。
上記内容に従ってインストールをしてみたところ、virtualenvを入れるところでエラーに遭遇しました。
環境構築自体は今回割愛しますが、解決方法をメモしておきます。
この記事の実行環境は下記のとおりです。
sudo pip install virtualenv virtualenvwrapperを実行するとsixをインストールしようとしてエラーが発生。
既に入っているsixに対してアンインストールを試みてエラーになっていそう。
yosuke-no-MBP:~ yosukekirihata$ sudo pip install virtualenv virtualenvwrapper The directory '/Users/yosukekirihata/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. The directory '/Users/yosukekirihata/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. Collecting virtualenv Downloading virtualenv-15.0.3-py2.py3-none-any.whl (3.5MB) 100% |████████████████████████████████| 3.5MB 351kB/s Collecting virtualenvwrapper Downloading virtualenvwrapper-4.7.2.tar.gz (90kB) 100% |████████████████████████████████| 92kB 4.5MB/s Collecting virtualenv-clone (from virtualenvwrapper) Downloading virtualenv-clone-0.2.6.tar.gz Collecting stevedore (from virtualenvwrapper) Downloading stevedore-1.18.0-py2.py3-none-any.whl Collecting pbr>=1.6 (from stevedore->virtualenvwrapper) Downloading pbr-1.10.0-py2.py3-none-any.whl (96kB) 100% |████████████████████████████████| 102kB 2.4MB/s Collecting six>=1.9.0 (from stevedore->virtualenvwrapper) Downloading six-1.10.0-py2.py3-none-any.whl Installing collected packages: virtualenv, virtualenv-clone, pbr, six, stevedore, virtualenvwrapper Running setup.py install for virtualenv-clone ... done Found existing installation: six 1.4.1 DEPRECATION: Uninstalling a distutils installed project (six) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project. Uninstalling six-1.4.1: Exception: Traceback (most recent call last): File "/Library/Python/2.7/site-packages/pip-9.0.0-py2.7.egg/pip/basecommand.py", line 215, in main status = self.run(options, args) File "/Library/Python/2.7/site-packages/pip-9.0.0-py2.7.egg/pip/commands/install.py", line 342, in run prefix=options.prefix_path, File "/Library/Python/2.7/site-packages/pip-9.0.0-py2.7.egg/pip/req/req_set.py", line 778, in install requirement.uninstall(auto_confirm=True) File "/Library/Python/2.7/site-packages/pip-9.0.0-py2.7.egg/pip/req/req_install.py", line 752, in uninstall paths_to_remove.remove(auto_confirm) File "/Library/Python/2.7/site-packages/pip-9.0.0-py2.7.egg/pip/req/req_uninstall.py", line 115, in remove renames(path, new_path) File "/Library/Python/2.7/site-packages/pip-9.0.0-py2.7.egg/pip/utils/__init__.py", line 267, in renames shutil.move(old, new) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move copy2(src, real_dst) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2 copystat(src, dst) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat os.chflags(dst, st.st_flags) OSError: [Errno 1] Operation not permitted: '/tmp/pip-0piI38-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info' yosuke-no-MBP:~ yosukekirihata$
pip installの--ignore-installedオプションでsixのインストールを除外する
yosuke-no-MBP:~ yosukekirihata$ sudo pip install virtualenv virtualenvwrapper --ignore-installed six The directory '/Users/yosukekirihata/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. The directory '/Users/yosukekirihata/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. Collecting virtualenv Downloading virtualenv-15.0.3-py2.py3-none-any.whl (3.5MB) 100% |████████████████████████████████| 3.5MB 333kB/s Collecting virtualenvwrapper Downloading virtualenvwrapper-4.7.2.tar.gz (90kB) 100% |████████████████████████████████| 92kB 3.4MB/s Collecting six Downloading six-1.10.0-py2.py3-none-any.whl Collecting virtualenv-clone (from virtualenvwrapper) Downloading virtualenv-clone-0.2.6.tar.gz Collecting stevedore (from virtualenvwrapper) Downloading stevedore-1.18.0-py2.py3-none-any.whl Collecting pbr>=1.6 (from stevedore->virtualenvwrapper) Downloading pbr-1.10.0-py2.py3-none-any.whl (96kB) 100% |████████████████████████████████| 102kB 2.2MB/s Installing collected packages: virtualenv, virtualenv-clone, pbr, six, stevedore, virtualenvwrapper Running setup.py install for virtualenv-clone ... done Running setup.py install for virtualenvwrapper ... done Successfully installed pbr-1.10.0 six-1.10.0 stevedore-1.18.0 virtualenv-15.0.3 virtualenv-clone-0.2.6 virtualenvwrapper-4.7.2 yosuke-no-MBP:~ yosukekirihata$
virtualenv virtualenvwrapperをインストールできた!
参考Webページ
エラー対処方法:pip installの--ignore-installedオプションでsixのインストールを除外
OS X EI Caption(10.11.1)でAWS CLIのインストールエラー - Qiita
Zynq PSのGPIO割り込みを扱うスタンドアロンのプログラム
以前、Zynq PLのGPIO割り込みを扱うスタンドアロンのプログラム - ぼくの技術日誌としてPLのGPIO割り込みを処理するスタンドアロンプログラムを紹介しました。
今回はPS側のスタンドアロンプログラムをメモしておきます。
実際にXilinx SDK 2015.4で動作を確認しました。
このBlog、ほかにもI2CやSPIなど様々なサンプルプログラムが紹介されていて、大変有用そうです!
ぼやき
4月頃は頑張ってBlogの記事を書いてたんだけど、見てのとおりで最近更新できてません…
春先は「今年はZynqとLinuxを主軸に頑張るぞ!」と息巻いていたのに。
5月に出たVivado 2016.2とPetaLinux SDK 2016.2もリリース直後から情報はみているけれど、環境更新もできてません。
リリースノートの感じではZynq MPSoC対応が主なので、「僕にはあんまり関係ないだろうし良いかなー」
と思ってますが、Linux Kernelはアップデートしておくのが良さそうだから、やっぱり更新するのがいいかな。
XilinxのGithubにmeta-petalinuxというリポジトリができているのも少し気になっている。
見た感じ、YoctoのPetaLinux版(というかPetaLinux自体Yoctoベースなわけですけれど。)みたい。
パッケージの追加ができそう。
Yoctoも出始めた時にビルドだけしてみて終わっている。FPGAマガジンやInterfaceでもたまに取り上げられているし、
触っておきたいんだけれど。これはもっと後になりそう…
また、Linuxデバイスドライバを自作できるようになりたいと思って色々調べていたけれど、それも休止中…
Userspace I/Oを使ってみたり、自作Platformドライバを使ってGPIO割り込みをユーザー空間で検出するというのはやって(なんとなく)できた。
Platformドライバについては整理してちゃんと自分の知識として吸収したいが、もう3ヶ月程が経過して忘れてきている…
ZynqについてもPLを扱えるようになったらできることの幅が広がって楽しそうなんだけれど、VHDL本を積じゃってる。
HLSやSDSoCなんかも気になっているけれど、イマイチ漠然としていているまま。
VisualStudio2015とVisual C++ for Linux Developmentを使ってみる
はじめに
最近、Microsoftが公開したVisualStudio向けLinuxアプリ開発アドオン、Visual C++ for Linux Developmentを使ってみました。
既に詳細な解説をしてくださっている方が多いので、今回はリンクをまとめておく程度で。
なお、こちらの実行環境は下記のとおりです。
- ホストOS:Windows7 x64
- 仮想化ソフト:VirtualBox 5.0.14
- ゲストOS:Ubuntu 14.04.3 amd64
環境構築
下記リンク先に従ってVisual Studio Community 2015とVisual C++ for Linux Developmentをインストールすれば、Visual StudioでLinuxアプリのデバッグ実行ができます。
Visual C++ for Linux Development | Visual C++ Team Blog
Visual C++ for Linux and Raspberry Pi Development - Scott Hanselman
実行環境となるLinuxにg++とsshサーバーをインストールさせているあたり、ssh経由でLinux上でプログラムをビルドさせているような気がします。
Visual Studioにてプロジェクトのプロパティを見てみると、コンパイラ設定の欄(構成プロパティ->General->Platform Toolset)が「Remote_GCC_1_0」と書いているあたりからもそう思えます。
また、ゲストとホストで実行ファイルが生成される様子をウィンドウを並べてみてみると、ゲスト→ホストの順に実行ファイルが生成されていました。
はまりどころ
/usr/includeの補完が効かず、これでは本格的に使えないかなーと思っていたら、sambaで共有することで解決されている方がいました。
ありがとうございます!
詳細は下記リンク先の「おまけ」をご覧ください。