【已解决】virtualenv报错AssertionError

原创文章,转载请注明: 转载自勤奋的小青蛙
本文链接地址: 【已解决】virtualenv报错AssertionError

virtualenv新建环境时报错:

AssertionError: Filename D:\Python34\Lib\os.py does not start with any of these prefixes: ['D:\\python34', 'D:\\python34']

E:\flasky>virtualenv venv
Using base prefix 'd:\\python34'
Traceback (most recent call last):
  File "D:\Python34\Lib\runpy.py", line 170, in _run_module_as_main
    "__main__", mod_spec)
  File "D:\Python34\Lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "D:\Python34\Scripts\virtualenv.exe\__main__.py", line 9, in <module>
  File "d:\python34\lib\site-packages\virtualenv.py", line 711, in main
    symlink=options.symlink)
  File "d:\python34\lib\site-packages\virtualenv.py", line 924, in create_environment
    site_packages=site_packages, clear=clear, symlink=symlink))
  File "d:\python34\lib\site-packages\virtualenv.py", line 1131, in install_python
    copy_required_modules(home_dir, symlink)
  File "d:\python34\lib\site-packages\virtualenv.py", line 1061, in copy_required_modules
    dst_filename = change_prefix(filename, dst_prefix)
  File "d:\python34\lib\site-packages\virtualenv.py", line 1035, in change_prefix
    (filename, prefixes)
AssertionError: Filename D:\Python34\Lib\os.py does not start with any of these prefixes: ['D:\\python34', 'D:\\python34']

解决办法:

virtualenv -p <PATH TO PYTHON.EXE> venv

指定自己的python.exe路径即可。

解决后:

E:\flasky>virtualenv -p D:\Python34\python.exe  venv
Running virtualenv with interpreter D:\Python34\python.exe
Using base prefix 'D:\\Python34'
New python executable in E:\flasky\venv\Scripts\python.exe
Installing setuptools, pip, wheel...done.

E:\flasky>

参考:
http://stackoverflow.com/questions/8688709/virtualenv-on-windows-7-returns-assertionerror/8688733

原创文章,转载请注明: 转载自勤奋的小青蛙
本文链接地址: 【已解决】virtualenv报错AssertionError

文章的脚注信息由WordPress的wp-posturl插件自动生成



|2|left
打赏

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: