python - Why is virtualenvwrapper not adding my environment location to my $PATH -


i trying create django project, using virtualenvwrapper isolate/sandbox different projects.

here commands typed far ...

memyself@somebox:~/path/to/foo_project$ mkvirtualenv foo using base prefix '/usr' new python executable in /home/memyself/.virtualenvs/foo/bin/python3 creating executable in /home/memyself/.virtualenvs/foo/bin/python installing setuptools, pip, wheel...done. virtualenvwrapper.user_scripts creating /home/memyself/.virtualenvs/foo/bin/predeactivate virtualenvwrapper.user_scripts creating /home/memyself/.virtualenvs/foo/bin/postdeactivate virtualenvwrapper.user_scripts creating /home/memyself/.virtualenvs/foo/bin/preactivate virtualenvwrapper.user_scripts creating /home/memyself/.virtualenvs/foo/bin/postactivate virtualenvwrapper.user_scripts creating /home/memyself/.virtualenvs/foo/bin/get_env_details 

i installed django in foo env:

(foo) memyself@somebox:~/path/to/foo_project$ pip install django collecting django   using cached django-1.10.3-py2.py3-none-any.whl installing collected packages: django installed django-1.10.3 

i proceed attempt create django website entering following commands:

(foo) memyself@somebox:~/path/to/foo_project.foo$ python django-admin.py startproject mysite python: can't open file 'django-admin.py': [errno 2] no such file or directory (foo) memyself@somebox:~/path/to/foo_project.foo$  

not believing seeing, decide run few checks, make sure i'm not going mad ...

(foo) memyself@somebox:~/path/to/foo_project.foo$ pip list --format=legacy django (1.10.3) pip (9.0.1) setuptools (28.8.0) wheel (0.29.0)   (foo) memyself@somebox:~/path/to/foo_project.foo$ pip show django name: django version: 1.10.3 summary: high-level python web framework encourages rapid development , clean, pragmatic design. home-page: http://www.djangoproject.com/ author: django software foundation author-email: foundation@djangoproject.com license: bsd location: /home/memyself/.virtualenvs/foo/lib/python3.5/site-packages requires:    (foo) memyself@somebox:~/path/to/foo_project.foo$ django-admin.py /home/memyself/.virtualenvs/foo/bin/django-admin.py 

i'm using simple heuristic guy(s?) created , maintain virtualenvwrapper is(are) smarter - however, not (automagically) adding newly created environment path, reeks of incompetence bordering on malice.

it highly unlikely (no, impossible) developer/mainteners incompetent - leaves possible explanation i'm missing obvious , doing foolish.

so (pun unintended) - what doing wrong?!

why can't execute python djan-admin.py startproject xxx after creating new virt environment using virtualenvwrapper?

you don't need run python django-admin.py (in fact shouldn't), run django-admin.py. python isn't searching $path; it's going file in current directory. long django-admin.py has execute bit set, can use command without explicitly running python.

it installs django-admin, can make command line little cleaner:

django-admin startproject mysite 

you don't need .py extension.

the underlying reason virtualenv modifies $path, shell (bash or whatever) uses locate command execute. when run python foo.py, command python, , $path searched that. foo.py command argument, , shell doesn't @ all. when python runs, looks foo.py in current directory (and accepts relative path ../otherdir/foo.py or absolute path /home/someone/foo.py); doesn't care $path @ all.


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -