Python 似乎没有使用 venv

venv doesn't appear to be getting used by Python

我在 Mac 上安装了 Python。如果我 运行 python -V 它输出 3.7.2

如果我运行以下:

virtualenv venv
source venv/bin/activate
python -V

我明白了3.7.2

如果我尝试 运行 nose 我得到这个错误:

$ nosetests -s -v config_test.test_config:TestConfiguration
Failure: ModuleNotFoundError (No module named 'boto3') ... ERROR

======================================================================
ERROR: Failure: ModuleNotFoundError (No module named 'boto3')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/nose/failure.py", line 39, in runTest
raise self.exc_val.with_traceback(self.tb)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/nose/loader.py", line 418, in loadTestsFromName
addr.filename, addr.module)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/nose/importer.py", line 47, in importFromPath
return self.importFromDir(dir_path, fqname)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/nose/importer.py", line 94, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/imp.py", line 234, in load_module
return load_source(name, filename, file)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/imp.py", line 172, in load_source
module = _load(spec)
  File "<frozen importlib._bootstrap>", line 675, in _load
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
  File "/Users/me/git/sdk-python-config/config_test/config_sdk.py", line 4, in <module>
import boto3
ModuleNotFoundError: No module named 'boto3'

----------------------------------------------------------------------
Ran 1 test in 0.001s

FAILED (errors=1)

我立即关注 3.6 参考文献。

如果我然后 运行 pip install boto3 我可以在 运行 pip list 时看到包裹但是当我尝试 [=40= 时我得到与上面相同的错误]再次启用我的应用程序。

我已经尝试了 pyenv global 3.7.2pyenv local 3.7.2,但两者都没有任何区别。

任何人都可以提出问题所在吗?

nose 未安装在 venv 中。在我使用 pip install nose 安装它之后,我不得不停用 venv 并重新激活它。