virtualenv新建环境时报错:
AssertionError: Filename D:\Python34\Lib\os.py does not start with any of these prefixes: ['D:\\python34', 'D:\\python34']
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 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' ] |
解决办法:
1 | virtualenv -p <PATH TO PYTHON.EXE> venv |
指定自己的python.exe路径即可。
解决后:
1 2 3 4 5 6 7 | 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
文章的脚注信息由WordPress的wp-posturl插件自动生成