[英]whitespace in path in bash command python file
I set up a python virtual environment in python 3.6. 我在python 3.6中设置了python虚拟环境。 the venv works, but pip does not.
venv有效,但pip无效。 When running a pip command I get this error:
运行pip命令时出现此错误:
-bash: /Users/username/Library/Application Support/McNeel/Rhinoceros/Scripts/craftr_rhino/venv/bin/pip: "/Users/username/Library/Application\: bad interpreter: No such file or directory
There seems to be a problem with the white space in the bash command in the (by virtualenv generated) pip file: (由virtualenv生成的)pip文件中的bash命令中的空格似乎存在问题:
#!"/Users/username/Library/Application Support/McNeel/Rhinoceros/Scripts/craftr_rhino/venv/bin/python3"
# -*- coding: utf-8 -*-
import re
import sys
from pip import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(main())
The path is already in between quotations, how can I get pip to understand the bash command? 引号之间已经存在路径,如何获得pip以了解bash命令?
edit: 编辑:
Already tried: 已经尝试过:
".../Application\ Support/..."
".../Application\\ Support/..."
'.../Application Support/...'
No quotation needed for bash and backslash all white spaces like this: bash和反斜杠都不需要引号,如下所示:
#!/Users/username/Library/Application\ Support/McNeel/Rhinoceros/Scripts/craftr_rhino/venv/bin/python3
I'm not on a Mac now, but I believe there is somewhere on OSX a command call env, on linux is under /usr/bin path, that can brings up your python environment: 我现在不在Mac上,但是我相信OSX上的某个地方叫env命令,在Linux上是/ usr / bin路径下的命令,它可以启动您的python环境:
#!/usr/bin/env python
And you just have to set the python3.6 in our $python shell var when call your script or set it to your bash.rc file 而且,只需在调用脚本或将其设置为bash.rc文件时在$ python shell var中设置python3.6即可
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.