python 虚拟环境virtualenv的安装和使用

使用pip install virtualenv安装虚拟环境,安装好以后,

执行virtualenv django_test来创建虚拟环境,如果创建时出现ascii下面这种错误

G:\>virtualenv test
New python executable in test\Scripts\python.exe
Installing setuptools, pip, wheel...
  Complete output from command G:\test\Scripts\python.exe -c "import sys, pip; s
ys...d\"] + sys.argv[1:]))" setuptools pip wheel:
  Ignoring indexes: https://pypi.python.org/simple
Collecting setuptools
  The repository located at None is not a trusted or secure host and is being ig
nored. If this repository is available via HTTPS it is recommended to use HTTPS
instead, otherwise you may silence this warning and allow it anyways with '--tru
sted-host None'.
  The repository located at None is not a trusted or secure host and is being ig
nored. If this repository is available via HTTPS it is recommended to use HTTPS
instead, otherwise you may silence this warning and allow it anyways with '--tru
sted-host None'.
  The repository located at None is not a trusted or secure host and is being ig
nored. If this repository is available via HTTPS it is recommended to use HTTPS
instead, otherwise you may silence this warning and allow it anyways with '--tru
sted-host None'.
  The repository located at None is not a trusted or secure host and is being ig
nored. If this repository is available via HTTPS it is recommended to use HTTPS
instead, otherwise you may silence this warning and allow it anyways with '--tru
sted-host None'.
  The repository located at None is not a trusted or secure host and is being ig
nored. If this repository is available via HTTPS it is recommended to use HTTPS
instead, otherwise you may silence this warning and allow it anyways with '--tru
sted-host None'.
  The repository located at None is not a trusted or secure host and is being ig
nored. If this repository is available via HTTPS it is recommended to use HTTPS
instead, otherwise you may silence this warning and allow it anyways with '--tru
sted-host None'.
  Could not find a version that satisfies the requirement setuptools (from versi
ons: )
No matching distribution found for setuptools
----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
  File "D:\program files\Python27\Scripts\virtualenv-script.py", line 9, in 
ule>
    load_entry_point('virtualenv==13.1.0', 'console_scripts', 'virtualenv')()
  File "D:\Program Files\Python27\lib\site-packages\virtualenv-13.1.0-py2.7.egg\
virtualenv.py", line 832, in main
    symlink=options.symlink)
  File "D:\Program Files\Python27\lib\site-packages\virtualenv-13.1.0-py2.7.egg\
virtualenv.py", line 1004, in create_environment
    install_wheel(to_install, py_executable, search_dirs)
  File "D:\Program Files\Python27\lib\site-packages\virtualenv-13.1.0-py2.7.egg\
virtualenv.py", line 969, in install_wheel
    'PIP_NO_INDEX': '1'
  File "D:\Program Files\Python27\lib\site-packages\virtualenv-13.1.0-py2.7.egg\
virtualenv.py", line 910, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command G:\test\Scripts\python.exe -c "import sys, pip; sys...d\"] + sy
s.argv[1:]))" setuptools pip wheel failed with error code 1

使用下面的语句来创建

virtualenv test --no-setuptools --no-pip --no-wheel

创建成功后

使用test\Scripts\activate来进入虚拟环境

注意:test是当前创建的虚拟环境的地址

前面会出现(test)以及对应的目录


创建完毕

使用exit来退出即可

你可能感兴趣的:(软件的使用以及安装的错误解决)