이상한 문제를 해결하기위한 단서 또는 해결책을 찾고 있습니다.import : python에서 명령어를 찾을 수 없습니다. 3.5
[sc-d02-087-017:~]$ cat mytest.py
#!/build/toolchain/lin64/python-3.5.1/bin/python
import platform, sys
print(platform.system())
sys.exit(0)
내가 쉘 실행 파일과 내 테스트 프로그램을 실행하기 위해 노력하고있어,하지만이 자사의 파이썬 프로그램이 주어진 /build/toolchain/lin64/python-3.5.1/bin/에 의해 해석하는 것을 인식하지 쉘을 파이썬 대신 err을 던집니다.
[sc-d02-087-017:~]$ ./mytest.py
./mytest.py: line 2: import: command not found
./mytest.py: line 3: syntax error near unexpected token `platform.system'
./mytest.py: line 3: `print(platform.system())'
그러나이 의견 요청으로
[sc-d02-087-017:~]$ /build/toolchain/lin64/python-3.5.1/bin/python -c 'import platform, sys;print(platform.system());'
Linux
내 컴퓨터가 64 아치
[sc-d02-087-017:~]$ uname -a
Linux sc-d02-087-017 2.6.18-308.8.1.el5 #1 SMP Tue May 29 14:57:25 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux
를 기반 및/또는 명령 줄로 파이썬 프롬프트 예상 작품과 같이
[sc-d02-087-017:~]$ xxd mytest.py | head
0000000: 2321 2f62 7569 6c64 2f74 6f6f 6c63 6861 #!/build/toolcha
0000010: 696e 2f6c 696e 3634 2f70 7974 686f 6e2d in/lin64/python-
0000020: 332e 352e 312f 6269 6e2f 7079 7468 6f6e 3.5.1/bin/python
0000030: 332e 350a 696d 706f 7274 2070 6c61 7466 3.5.import platf
0000040: 6f72 6d2c 2073 7973 0a70 7269 6e74 2870 orm, sys.print(p
0000050: 6c61 7466 6f72 6d2e 7379 7374 656d 2829 latform.system()
0000060: 290a 7379 732e 6578 6974 2830 290a ).sys.exit(0).
[sc-d02-087-017:~]$ ls -l mytest.py
-rwxr-xr-x 1 mmopuru mts 110 Jun 2 17:23 mytest.py
'/ build/toolchain/lin64/python-3.5.1/bin/python'을 확인하십시오. –
무엇을 확인 하시겠습니까? 존재인가? 그것은 왜 프롬프트가 작동하는지에 대한 것입니다. –
[sc-d02-087-017 : ~] $ xxd mytest.py | 머리 0000000 :! 2321 2f62 7569 6c64 2f74 6f6f 6c63 6861 #/구축/toolcha 0,000,010 :/lin64에서 696e 2f6c의 696e 3634 2f70 7974 686f 6e2d/python- 0,000,020 : 332e 352e 312f 6269 6e2f 7079 7468 6f6e 3.5.1/빈/파이썬 0,000,030 : 332e 350A 696d 706f 7274 2070 7466 6c61 3.5.import의 platf 0,000,040 : 6f72 6d2c 2,073 7,973 7,269 0a70 6e74 2,870 ORM, sys.print (p 0,000,050 : 7466 6c61 6f72 6d2e 7,379 7,374 2,829 656d latform.system() 0000060 : 290a 7379 732e 6578 6974 2830 290a) .sys.exit (0). –