- /usr/bin/env: ‘python3\r’: нет такого файла или каталога
- 1 ответ
- Python permission denied
- #!/usr/bin/python
- Saved searches
- Use saved searches to filter your results more quickly
- [Errno 13] Permission denied How i solve this problem #236
- [Errno 13] Permission denied How i solve this problem #236
- Comments
- /usr/bin/python: bad interpreter: Permission denied error
- Comments
/usr/bin/env: ‘python3\r’: нет такого файла или каталога
Я пытаюсь сделать мой .py исполняемые файлы, чтобы я мог запустить их с помощью ./filename.py , но это не работает для меня.
Что я сделал, так это добавил Шебанг #!/usr/bin python3 и использовал команду chmod +x filename.py , Когда я бегу ./filename.py затем, как обычный пользователь, я получаю сообщение об ошибке ниже
bash: ./filename.py: /usr/bin: bad interpreter: Permission denied
Как суперпользователь, он говорит мне об этом:
sudo: unable to execute ./filename.py: Permission denied
Открытие файла обычным способом ( python3 filename.py ) все работает отлично.
Когда я изменил Шебанг на #!/usr/bin/env python3 это говорит мне это:
/usr/bin/env: ‘python3\r’: No such file or directory
1 ответ
Проблема в том, что ваши символы заканчиваются строкой. Ваш файл был создан или отредактирован в системе Windows и использует окончания строк в стиле Windows/DOS (CR+LF), тогда как в системах Linux, таких как Ubuntu, требуются окончания строк в стиле Unix (LF).
Существует простой инструмент, который может конвертировать два разных стиля для вас называется dos2unix ,
sudo apt install dos2unix
После этого вы можете конвертировать файлы в любом направлении, используя одну из команд
dos2unix /PATH/TO/YOUR/WINDOWS_FILE unix2dos /PATH/TO/YOUR/LINUX_FILE
$ cat test.py #!/usr/bin/env python3 print("ok") $ ./test.py /usr/bin/env: ‘python3\r’: No such file or directory $ dos2unix test.py dos2unix: converting file test.py to Unix format . $ ./test.py ok
Чтобы также вернуться к тому, что вы попробовали в первую очередь, линия Шебанга
конечно неправильно. Он пытается выполнить файл /usr/bin с python3 и имя вашего скрипта в качестве аргументов. Это должно очевидно потерпеть неудачу /usr/bin каталог, а не исполняемый файл
Python permission denied
при запуске скрипта «как исполняемого» ./test.py Выводит:
Bash: ./test.py: /usr/bin: bad interpriter: Permission denied
sudo: unable to execute ./test.py: Permission denied
Вопрос: что я делаю не так?
Чего? Это кто? Я знаю только таких:
thunar ★★★★★ ( 04.04.19 00:10:10 MSK )
Последнее исправление: thunar 04.04.19 00:10:38 MSK (всего исправлений: 1)
Пиши либо /usr/bin/python либо /usr/bin/env python
#!/usr/bin/python
Исправил, ошибка следующая:
bash: ./test.py: /usr/bin/python^M: bad interpriter: No such file or directory
/usr/bin/env: 'python\r': No such file or directory
Так ты ещё и под offtop-ом. Ну так хоть notepad++ поставь для приличия. Он тебе разъяснит, где ты неправ.
/usr/bin: bad interpriter: Permission denied
/usr/bin — это папка, она не может быть выполнена, об этом система тебе и сообщает. права доступа к твоему скрипту тут ни при чём.
по второй ошибке: перевод строки в линуксе — это символ с кодом 10, а не 13, как у тебя (в венде), который воспринимается ядром как продолжение имени интерпретатора вместо конца строки.
Судя по тегам он не под оффтопом, просто файл создан там каким-то клоуном, который где-то читал о шебанге. Оп, тебе надо перекодировать концы строк в исходнике с dos на unix — либо редактором, который это умеет, либо в командной строке через dos2unix (iirc).
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Errno 13] Permission denied How i solve this problem #236
[Errno 13] Permission denied How i solve this problem #236
Comments
I try to install google assistant on raspberry PI 3 by this code
python -m pip install google-assistant-sdk[samples]
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: ‘/usr/lib/python2.7/dist-packages/pyasn1/error.py’
Consider using the —user option or check the permissions.
The text was updated successfully, but these errors were encountered:
@moham96 thnku also worked in my case.
I am using Ubuntu
I am trying to install pandas in anaconda and i was getting same error permission denied
The code i tried is:
python3 -m venv env
source ./env/bin/activate
python -m pip install pandas
I am getting this error:
File «», line 1
python3 -m venv env
^
SyntaxError: invalid syntax
Which version of Python are you using?
I don’t know why it was showing the error then, but I tried once again now and used only-
python3 -m pip install pandas
commenting to save the probable solution
While installing tensorflow with native pip in ubuntu 16.04 it shows me an error:
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: ‘/usr/local/lib/python3.5/dist-packages/gast’
Consider using the —user option or check the permissions.
Anyone can help me solve this problem!
Thanks
pip install —user tensorflow
I am using python 2.7 version
I tried using python2 -m install pandas. But I am getting error telling «command is not recognized as internal or external command»
use
python2 -m pip install pandas
you left out pip
Thank you moham96 It also helped to solve my problem.
Obrigado Mohamed, só você resolveu meu problema!
Mas agora o meu terminal está assim:
Im trying to execute the DirichletForest topic modeling code in bash/Linux which has been published on GitHub http://pages.cs.wisc.edu/~andrzeje/research/df_lda.html
While I’m executing the code in py2.7 Linux, I get this error :
omar@DESKTOP-0CAAKGI:/mnt/c/Users/omar3/Desktop/sentiment-analysis/coding/arXivLDA/code/LDAlike/DF-LDA-0.1.1$ python setup.py install
running install
running build
running build_py
running build_ext
running install_lib
copying build/lib.linux-x86_64-2.7/ConstraintCompiler.py -> /usr/local/lib/python2.7/dist-packages
error: [Errno 13] Permission denied: ‘/usr/local/lib/python2.7/dist-packages/ConstraintCompiler.py’
omar@DESKTOP-0CAAKGI:/mnt/c/Users/omar3/Desktop/sentiment-analysis/coding/arXivLDA/code/LDAlike/DF-LDA-0.1.1$
That error is usually because of user permission stuff.Just use «pip install —user numpy«. That should work. In case it doesn’t then Try using «sudo» before the command. @omarjnb
On Windows server. Open the command prompt by «Run as Administrator» and try again.
I am trying to install face_recognition in jupyter terminal in Anaconda Navigator, using python 2.7
I used the command:
pip install face_recognition
Then it is showing that :
Requirement already satisfied: face_recognition in ./anaconda2/lib/python2.7/site-packages
But when I run :
import face_recognition
it is showing that :
ImportError: No module named face_recognition
Then I checked the Face Recognition Installation Documentation:
From there I got the command pip2 install face_recognition
when i tried that I got the error:
sts:~$ pip2 install face_recognition
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/init.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
warnings.warn(warning, RequestsDependencyWarning)
Collecting face_recognition
Using cached https://files.pythonhosted.org/packages/3f/ed/ad9a28042f373d4633fc8b49109b623597d6f193d3bbbef7780a5ee8eef2/face_recognition-1.2.3-py2.py3-none-any.whl
Requirement already satisfied: Pillow in /usr/lib/python2.7/dist-packages (from face_recognition) (3.1.2)
Collecting dlib>=19.7 (from face_recognition)
Requirement already satisfied: numpy in /usr/local/lib/python2.7/dist-packages (from face_recognition) (1.14.5)
Collecting face-recognition-models>=0.3.0 (from face_recognition)Collecting Click>=6.0 (from face_recognition)
Using cached https://files.pythonhosted.org/packages/34/c1/8806f99713ddb993c5366c362b2f908f18269f8d792aff1abfd700775a77/click-6.7-py2.py3-none-any.whl
Installing collected packages: dlib, face-recognition-models, Click, face-recognition
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: ‘/usr/local/lib/python2.7/dist-packages/dlib.so’
Consider using the —user option or check the permissions.
How to overcome this error?
/usr/bin/python: bad interpreter: Permission denied error
I have a Python script, myscript.py with a #!/usr/bin/python shebang* at the top and tried to execute it on Ubuntu Linux using ./myscript.py . I got the following error message:
bash: ./myscript.py: /usr/bin/python: bad interpreter: Permission denied
- The file should be executable (use chmod +x myscript.py )
- The file shoud have Unix line endings
- The file shouldn’t be on a fat32 or ntfs filesystem. Apparently, bash can’t handle scripts that are stored on fat32 or ntfs
- The shebang line must be less than 128 characters (on Linux)
UPDATE 2015-09-23: 7 years later, I ran into this error again on our Jenkins server. A shebang line that is too long will also cause this error. On Linux, the maximum length is 128 characters. See:
* #!/usr/bin/env python would be the more portable shebang.
Comments
I had the same problem when transfer a python script that I had started in Windows to my Macbook. Good old dos2unix to the rescue, and presto! It worked.
#2 Eliot commented on 2008-10-20 :
Skawaii, I haven’t used dos2unix myself, but glad to hear that it worked well for you.
#3 JackChen commented on 2014-05-22 :
I got the same error in RedHat. Python 2.7.3 is configured and made by myself. [[email protected] installer]# pip install Django -bash: /usr/local/bin/pip: /usr/local/bin/python2.7: bad interpreter: Permission denied
Solution: In /usr/local/bin/pip, replace first line #!/usr/local/bin/python2.7 with your actual Python path #!/root/installer/Python-2.7.5/python