回答編集履歴

1

変更

2021/07/21 04:43

投稿

ppaul
ppaul

スコア24666

test CHANGED
@@ -1,21 +1,47 @@
1
- AnacondaのPythonとVScodeで使っているPythonが同じではない可能性が高いです。
1
+ ~~AnacondaのPythonとVScodeで使っているPythonが同じではない可能性が高いです。~~
2
2
 
3
3
 
4
4
 
5
- anaconda promptで以下を実行してみましょう。
5
+ ```message
6
6
 
7
- ```python
7
+ Please note and check the following:
8
8
 
9
- import sys
10
9
 
10
+
11
+ The Python version is: Python3.8 from "C:\Users\user.conda\envs\test\python.exe"
12
+
11
- print(sys.executable)
13
+ The NumPy version is: "1.20.3"
14
+
15
+ and make sure that they are the versions you expect.
16
+
17
+ Please carefully study the documentation linked above for further help.
12
18
 
13
19
  ```
14
20
 
15
- 次にVScodeで同じことを実行してみましょう。
16
21
 
22
+
17
- 表示されるパスが同じでなければ、使っているPythonが同じではないのが分かり
23
+ というのを見落としていました
18
24
 
19
25
 
20
26
 
27
+ condaを使って作ったtestのnumpyはどうやってインストールしましたか。
28
+
29
+ ここで手抜きをしてファイルのコピーで済ませるとか、環境変数とか、sys.pathへのappendとかでやるとおかしなことが起きます。
30
+
21
- その場合にはvscodeウィンドウ左下pythonの表示があるのでそれをクリックてanacondaのPythonに切替えしょう
31
+ またanacondaライブラリは基本的はcondaリポジトリから取得しないといけないで、pipでインストールするのも望まくありません
32
+
33
+
34
+
35
+ conda create -n test2 python=3.8 numpy
36
+
37
+
38
+
39
+ のような方法で作り、追加するときは
40
+
41
+
42
+
43
+ conda install -n test2 モジュール名
44
+
45
+
46
+
47
+ としてインストールしてください。