我有python 2.7.5,我安装了一些软件包
python setup.py install --user
所以在
中安装了这个包 /users/me/.local/lib/python2.7/site-packages
然后我将PYTHONPATH变量更新为
/users/me/.local/lib/python2.7/site-packages,/users/me/.local/lib/python2.7/site-packages
但现在如果我尝试
virtualenv
这是我安装的软件包,我得到了
bash: virtualenv: command not found
如何使用已安装在site-packages之外的virtualenv
包?
修改
这是我的sys.path
'', '/users/me/.local/lib/python2.7/site-packages/virtualenv-15.1.0.dev0-py2.7.egg', '/usr/lib/python2.7/site-packages/pip-7.1.2-py2.7.egg', '/usr/lib/python2.7/site-packages/supervisor-3.2.0-py2.7.egg', '/usr/lib64/python27.zip', '/usr/lib64/python2.7', '/usr/lib64/python2.7/plat-linux2', '/usr/lib64/python2.7/lib-tk', '/usr/lib64/python2.7/lib-old', '/usr/lib64/python2.7/lib-dynload', '/users/me/.local/lib/python2.7/site-packages', '/usr/lib64/python2.7/site-packages', '/usr/lib64/python2.7/site-packages/gtk-2.0', '/usr/lib/python2.7/site-packages', '/users/me/.local/lib/python2.7/site-packages'
但我仍然得到命令not found error
另外,这是我的$ PATH
/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/users/me/.local/lib/python2.7/site-packages:/users/me/.local/lib/python2.7/site-packages
答案 0 :(得分:0)
您可以在PYTHONPATH环境变量中将路径的值附加到新库。
How to add to the pythonpath in windows 7?
但您也可以在运行时追加路径。
import sys
sys.path.append('/dir1/dir2/libs')