简体   繁体   中英

Getting an error when trying to create a virtual env

I want to learn django so I tried to create a virtual env and I am getting this error:

mkvirtualenv django

Traceback (most recent call last):
  File "/usr/local/bin/virtualenv", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/Library/Python/2.7/site-packages/distribute-0.6.49-py2.7.egg/pkg_resources.py", line 2881, in <module>
    parse_requirements(__requires__), Environment()
  File "/Library/Python/2.7/site-packages/distribute-0.6.49-py2.7.egg/pkg_resources.py", line 596, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: virtualenv==1.8.2

I haven't used python in a while so i'm not sure what the issue is:

 virtualenv --version
Traceback (most recent call last):
  File "/usr/local/bin/virtualenv", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/Library/Python/2.7/site-packages/distribute-0.6.49-py2.7.egg/pkg_resources.py", line 2881, in <module>
    parse_requirements(__requires__), Environment()
  File "/Library/Python/2.7/site-packages/distribute-0.6.49-py2.7.egg/pkg_resources.py", line 596, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: virtualenv==1.8.2

You're using mkvirtualenv which is a virtualenvwrapper command. You probably do not have virtualenvwrapper installed.

Type virtualenvwrapper in your command line and observe the input. If you get something like command not found , then you should install it first.

You should install it with pip like so pip install virtualenvwrapper .

There are some post-installation steps, the most important one being source /usr/local/bin/virtualenvwrapper.sh that makes commands like mkvirtualenv, rmvirtualenv available.

See virtualenvwrapper's documentation .

Alternatively, you can also just make use of virtualenv . Check that you have it installed like so

virtualenv --version

If you do not, you can install it with pip . Once you have it installed, you can create your virtualenv like so virtualenv <name> in the directory of your choice.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM