所以我有一个基本的Python类模块,在其中导入了箭头库。
#!/usr/bin/env python3
import arrow
class SomeClass:
def __init__(self):
print("hello")
我有一个正在使用pytest some_test_file.py
调用的测试文件,该文件导入了SomeClass
模块。我得到E ModuleNotFoundError: No module named 'arrow'
。
我做了pip install arrow
和asdf reshim python
和asdf reshim python 3.7.2
,但仍然无法正常工作。
答案 0 :(得分:0)
您可能使用了错误的python。就像您可以在下面看到的那样:
pako@b00s:~$ pyenv shell 3.7.0
pako@b00s:~$ pip install arrow
Collecting arrow
Downloading https://files.pythonhosted.org/packages/f4/7f/0360628ba40bb93c10cd89cd289b6a8e9ea87b2db884b8edf32c80ee1c73/arrow-0.13.1-py2.py3-none-any.whl
Requirement already satisfied: python-dateutil in ./.pyenv/versions/3.7.0/lib/python3.7/site-packages (from arrow) (2.7.3)
Requirement already satisfied: six>=1.5 in ./.pyenv/versions/3.7.0/lib/python3.7/site-packages (from python-dateutil->arrow) (1.11.0)
Installing collected packages: arrow
Successfully installed arrow-0.13.1
pako@b00s:~$ vim some_test_file.py
pako@b00s:~$ python some_test_file.py
pako@b00s:~$ pip freeze | grep -i arrow
arrow==0.13.1