[PR]
[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。
[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。
I am not professional, so what I will tell you may be incorrect. I recommend you to check what you read are really correct comparing with other sources (and if you find any mistakes, please tell me about it).
I was installing Python and pip to my desktop PC. First I installed Python3. After a short time, I realized that Python2 were also needed in my use, so I installed it.
Unfortunately, after that, some articles on the Internet says that if not install Python2 before installation of Python3, I cannot control Python version. (Perhaps, there are other ways.)
Therefore, I uninstalled Python2 and Python3 through Control Panel, and reinstalled in the order of Python2 and Python3. In this way, I succesed installation of them.
However, when I tried to run pip command via command prompt to make sure that installation was succeed, some pip command did not work and the following error message was shown.
Fatal error in launcher: Unable to create process using "" ""
This message was displayed when I use the command like
pip "something"
If pip command work correctly, it is predicted that pip3 (pip of Python3) will run, but it didn't, though commands like
py -m pip "something"
worked...
Windows10 Pro
Python3.7.1
python2.7.15
First, I made sure that the path was set correctly. If you have never checked the path, you should do that referencing other article.
Second, I checked the path in Python and I confirmed that "bad path" did not exited. (*1)
I heard there is a path in Python, but I do not know well about it.
Moreover, I tried to update pip using the command below.
py -m pip install -U pip
To my disappointment, it told me that the version of pip was latest.
Finally, I did reinstall Python further again and I did it strictly. It solved the problem...
I uninstalled both Pythons and deleted all remaining files exited in the directory where Python were. In addition, I also deleted data related to pip which were in C:\Users\"UserName"\AppData\Local. After that, I install python2 followed by python3.
I do not think that checking it has meaning, but I write how did I check it just in case.
Via command prompt, I started Python and typed the next codes.
C:\******> python
>>> import sys
>>> sys.path
After that, some directories were shown and I checked them.
#include <algorithm>
#include <iostream>
int main() {
vector<int> A(5);
for (int i = 0; i < 5; ++i) {
cin>>A[i];
}
//肝心のソート部
sort(A.begin(), A.end());
for (int i = 0; i < 5; ++i) {
cout<<A[i]<<" ";
}
cout<<endl;
}
#include <algorithm>
#include <functional> //これが必要
#include <iostream>
int main() {
vector<int> A(5);
for (int i = 0; i < 5; ++i) {
cin>>A[i];
}
//肝心のソート部
sort(A.begin(), A.end(), greater<int>());
for (int i = 0; i < 5; ++i) {
cout<<A[i]<<" ";
}
cout<<endl;
}
#include <algorithm>
#include <iostream>
int main() {
vector<int> A(5);
for (int i = 0; i < 5; ++i) {
cin>>A[i];
}
//肝心のソート部
sort(A.rbegin(), A.rend());
for (int i = 0; i < 5; ++i) {
cout<<A[i]<<" ";
}
cout<<endl;
}
※やったことを備忘録的に列挙していくページです。
わかりやすさは他のwebページの方が優れているかと思います。うっかりこのページにたどり着いた方は、最下部の参考にあるサイト等を参照した方がわかりやすいでしょう。
起動可能なISOファイル(Windows、Linux、UEFIなど)からUSBインストールメディアを作成するときなどに使えるソフト。
出典: https://rufus.ie/
→BIOSの起動は間に合わなかったorz。こんな時は、再度コンピューターの電源を落として再起動させればもう一度挑戦できる。
→もともと入っていたWindows 7が起動すると予想したが、普通にUSBからUbuntuが起動。おそらくBIOSの設定で、OSはHDDよりもUSBメディアを優先するようになっていたのだろう。
→⑧でUbuntuのインストール中にアップデートをダウンロードする」を選ぶならwi-fiの設定はした方がいいかも
Pythonとpipのインストール時に、これらがうまくできたかを確認するため、コマンドプロンプトからそれぞれのコマンドを実行して確認していた。
だがpipコマンドの実行がうまくいかない。下記のようなエラーが出てしまうのだ。
Fatal error in launcher: Unable to create process using "" ""
これを解決したい。
素人が備忘録的に書いている記事です。必ずしも正しいわけではないので、鵜呑みにせずよく確認してください。
Windows10 Pro
Python3.7.1
python2.7.15
諸事情により、私は自宅のデスクトップパソコンへPythonを入れることになった。それもPython2とPython3の両方である。
はじめにPython3をいれた...のだが、ここでPython2を入れる必要があることに気が付く。そこでPython2を入れた。だがどうもネットで検索していると、先にPython2を入れ、そのあとPython3を入れないとうまくバージョン管理ができないらしい。(他にやりようはあるのかもしれないが。)
そこでそれぞれをコントロールパネルからアンインストール。Python2->Python3の順にインストールをし直したのだ。こうしてPython2とPython3はうまくインストールできたのである。だがpipコマンドの確認段階でつまずいてしまった。
pip コマンド
等の形で実行されるはずの、Python3のpipがうまく実行できないのである。
py -m pip コマンド
では実行できるのに...。
まず初めに、正しくPathが通っているかを調べ、問題がないことを確認した。人によってはこの段階で原因を発見できると思うが、詳しい説明は他のブログやサイトを参照してほしい。
次にPython内のPathである。存在するらしい。これを調べることに意味はなさそうだが、余計なところにPathが通っていないことを確認した。(注1)
またpipのアップデートも試みた。
py -m pip install -U pip
である。だが最新版であるという結果に。
そして最後にやったのがPython3の再インストールである。
まずPythonをアンインストールする。そして、もともとPythonがインストールされていたディレクトリ以下に残っているファイルを全て消去。さらにC:\Users\ユーザ名\AppData\Local以下にあるpipのデータも消去しておいた。その上でPythonを再度インストールするのである。私の場合はこれで解決した。
これに関しては的外れだと思うが、一応私が確認した方法について。
まず Python でPythonを実行。 import sys と sys.path で出力されたディレクトリを確認した。
日本語サイトでこの事に触れているサイトが見つからなかったので一応ここに…
常識過ぎて書かれていないなんてことはないと信じたい。
以前とある理由でめちゃくちゃシフトしたくなることがありまして、以下の様な感じのプログラム
unsigned long hoge;
hoge |= 1<<24;
を書いたわけですが、「変数に対して値が大きすぎる」みたいな警告(エラーだったか)が出てしまいまい、実際にうまくいきませんでした。
変数の大きさはコンパイラによって変わったりするものなので、念の為にlong型の大きさを確認してみましたが4byteで問題ない。で、調べたわけですがどうやらシフト出来る大きさにも上限があるらしく、その上限がavr-gccの場合「15」だそうです。
まあそんなわけで私は実装の仕方を変えて解決したわけですが、シフト数を変数などで指定する場合はうっかり上限を超えてしまったりするのでお気をつけを。特に変数で上限を超えてしまった場合などはそのことに気が付きにくいと思うので。