[英]whitespace in path in bash command python file
我在python 3.6中設置了python虛擬環境。 venv有效,但pip無效。 運行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
(由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())
引號之間已經存在路徑,如何獲得pip以了解bash命令?
編輯:
已經嘗試過:
".../Application\ Support/..."
".../Application\\ Support/..."
'.../Application Support/...'
bash和反斜杠都不需要引號,如下所示:
#!/Users/username/Library/Application\ Support/McNeel/Rhinoceros/Scripts/craftr_rhino/venv/bin/python3
我現在不在Mac上,但是我相信OSX上的某個地方叫env命令,在Linux上是/ usr / bin路徑下的命令,它可以啟動您的python環境:
#!/usr/bin/env python
而且,只需在調用腳本或將其設置為bash.rc文件時在$ python shell var中設置python3.6即可
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.