on MAC OS X, py.test not recognized as a command

ⅰ亾dé卋堺 提交于 2019-12-06 15:43:38

On OS X you should do:

pip install -U pytest 

or

easy_install -U pytest

http://pytest.org/latest/getting-started.html

Got it worked finally! After downloading pytest, I ran the following commands and it worked like magic. I think,earlier, I missed putting "sudo" infront of the install command:

$python setup.py build
$sudo python setup.py install

The output said:

..
Installing py.test script to /usr/local/bin
Installing py.test-2.7 script to /usr/local/bin
Installed /Library/Python/2.7/site-packages/pytest-2.6.4-py2.7.egg
..
Using /Users/admin/Library/Python/2.7/lib/python/site-packages
Finished processing dependencies for pytest==2.6.4

My .bash_profile contents, jfyr:

PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/System/Library/Frameworks/Python.framework/Versions/2.7/bin"
export PATH

For those of us trying to avoid any and all use of sudo:

  1. Download from PyPI here and unpack.
  2. $ cd <pytest download folder>
  3. $python setup.py build
  4. $python setup.py install --user
  5. Wherever the installing output says the "py.test script" has been installed to, add to PATH in your .bash_profile (or .bashrc if you use that for environment variables).
  6. Confirm the setup worked via $py.test --version
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!