簡體   English   中英

安裝成功后,在 Windows 10 Ubuntu 上運行的 Python3 中找不到 Python elasticsearch_dsl 模塊

[英]Python elasticsearch_dsl module not found in Python3 running on Windows 10 Ubuntu after successful installation

我在 Windows 10 Ubuntu 中成功安裝了 elasticsearch_dsl 模塊,但是在 Python3 中找不到該模塊。 任何人都可以闡明問題可能是什么?

當我在 Anaconda 中運行時它運行良好,但是因為我的大部分代碼都有 Unix 風格的文件路徑,我真的希望它在 ubuntu 上運行。

$ pip install elasticsearch_dsl
Collecting elasticsearch_dsl
  Using cached https://files.pythonhosted.org/packages/77/95/aa96ac42bf7cf8d56d4c7330f4fa5c1b2c460efa7ad2e9ba183bae823b0b/elasticsearch_dsl-7.0.0-py2.py3-none-any.whl
Collecting six (from elasticsearch_dsl)
  Using cached https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Collecting ipaddress; python_version < "3.3" (from elasticsearch_dsl)
  Using cached https://files.pythonhosted.org/packages/fc/d0/7fc3a811e011d4b388be48a0e381db8d990042df54aa4ef4599a31d39853/ipaddress-1.0.22-py2.py3-none-any.whl
Collecting python-dateutil (from elasticsearch_dsl)
  Using cached https://files.pythonhosted.org/packages/41/17/c62faccbfbd163c7f57f3844689e3a78bae1f403648a6afb1d0866d87fbb/python_dateutil-2.8.0-py2.py3-none-any.whl
Collecting elasticsearch<8.0.0,>=7.0.0 (from elasticsearch_dsl)
  Using cached https://files.pythonhosted.org/packages/ae/43/38329621bcca6f0b97e1cc36fb3cef889414a1960fcdc83a41e26b496634/elasticsearch-7.0.2-py2.py3-none-any.whl
Collecting urllib3>=1.21.1 (from elasticsearch<8.0.0,>=7.0.0->elasticsearch_dsl)
  Using cached https://files.pythonhosted.org/packages/e6/60/247f23a7121ae632d62811ba7f273d0e58972d75e58a94d329d51550a47d/urllib3-1.25.3-py2.py3-none-any.whl
Installing collected packages: six, ipaddress, python-dateutil, urllib3, elasticsearch, elasticsearch-dsl
Successfully installed elasticsearch-7.0.2 elasticsearch-dsl-7.0.0 ipaddress-1.0.22 python-dateutil-2.8.0 six-1.12.0 urllib3-1.25.3
$ python3
Python 3.6.7 (default, Oct 22 2018, 11:32:17)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import elasticsearch_dsl
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'elasticsearch_dsl'
>>>

預期的結果是該模塊將被識別並正確導入。 實際結果是 ModuleNotFoundError。 謝謝你的幫助。

pip3 install elasticsearch_dsl 工作。 顯然,至少在這種情況下,python3 需要 pip3。

這是pip的問題。

python3 -m pip show elasticsearch_dsl

然后你得到PATH

編輯你 Bash_profile

輸入sudo vim ~/.bash_profile並附加路徑

export PATH="$PATH:[elasticsearch_dsl PATH]"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM