如果您对pip安装/usr/local/opt/python/bin/python2.7:错误的解释器:没有这样的文件或目录感兴趣,那么这篇文章一定是您不可错过的。我们将详细讲解pip安装/usr/l
如果您对pip安装/usr/local/opt/python/bin/python2.7:错误的解释器:没有这样的文件或目录感兴趣,那么这篇文章一定是您不可错过的。我们将详细讲解pip安装/usr/local/opt/python/bin/python2.7:错误的解释器:没有这样的文件或目录的各种细节,此外还有关于/ usr / bin / env:python2:没有这样的文件或目录、/usr/bin/python^M: 解释器错误: 没有那个文件或目录、/usr/local/bin/python3:bad interpreter:ubuntu 14.04没有这样的文件或目录、Azure 函数 Python - 使用 file.open 时没有这样的文件或目录的实用技巧。
本文目录一览:- pip安装/usr/local/opt/python/bin/python2.7:错误的解释器:没有这样的文件或目录
- / usr / bin / env:python2:没有这样的文件或目录
- /usr/bin/python^M: 解释器错误: 没有那个文件或目录
- /usr/local/bin/python3:bad interpreter:ubuntu 14.04没有这样的文件或目录
- Azure 函数 Python - 使用 file.open 时没有这样的文件或目录
pip安装/usr/local/opt/python/bin/python2.7:错误的解释器:没有这样的文件或目录
我不知道这是怎么回事,但是我被困在一些无法解决的stackoverflow解决方案上。你能帮我吗?
Monas-MacBook-Pro:CS764 mona$ sudo python get-pip.py The directory ''/Users/mona/Library/Caches/pip/http'' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo''s -H flag. The directory ''/Users/mona/Library/Caches/pip/http'' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo''s -H flag. /tmp/tmpbSjX8k/pip.zip/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. Collecting pip Downloading pip-7.1.0-py2.py3-none-any.whl (1.1MB) 100% |████████████████████████████████| 1.1MB 181kB/s Installing collected packages: pip Found existing installation: pip 1.4.1 Uninstalling pip-1.4.1: Successfully uninstalled pip-1.4.1 Successfully installed pip-7.1.0 Monas-MacBook-Pro:CS764 mona$ pip --version -bash: /usr/local/bin/pip: /usr/local/opt/python/bin/python2.7: bad interpreter: No such file or directory
答案1
小编典典我曾使用自制软件在OS X 10.10上安装2.7,而新安装缺少符号链接。我跑了
brew link --overwrite python
如如何在Homebrew中符号链接python中所述?它解决了问题。
/ usr / bin / env:python2:没有这样的文件或目录
我试图在Ubuntu上为Emacs配置Python,但出现以下错误:
/usr/bin/env: python2: No such file or directory
有人可以帮我吗?我该怎么解决?
/usr/bin/python^M: 解释器错误: 没有那个文件或目录
【1】问题现象
执行python脚本,提示错误:/usr/bin/python^M: 解释器错误: 没有那个文件或目录
【2】原因分析
大多数是因为脚本文件在windows下编辑过。在windows下,每一行的结尾是\r\n,而在linux下文件的结尾是\n。
那么,你在windows下编辑过的文件在linux下打开看时候每一行就会多出来一个字符\r,而在linux下文件的结尾是\n,
用cat -A filename 时你可以看到这个\r字符被显示为^M,这时候只需要删除这个字符就可以了。
本地现象如下图:
【3】解决方案
3.1 Windows环境下
利用编辑器如UltraEdit或EditPlus等工具先将脚本编码转换,再放到Linux中执行。
转换操作步骤(UltraEdit): File——>Conversions——>DOS——>UNIX 即可。
3.2 Linux环境下
(1)先要确保文件有可执行权限: chmod 777 filename
(2)打开文件: vim filename
(3)查看格式。利用如下命令查看文件格式: :set fileformat 或 :set ff
(4)格式信息。应该可以看到如下信息: fileformat=dos 或 fileformat=unix
(5)修改格式。如下命令格式: :set ff=unix 或 :set fileformat=unix
(6)保存退出。你就可以以./filename方式执行filename文件了
Good Good Study, Day Day Up.
顺序 选择 循环 总结
/usr/local/bin/python3:bad interpreter:ubuntu 14.04没有这样的文件或目录
嗨我的python安装在不同的目录中,我正在使用基于mac的docker镜像,它在shell脚本的其他文件夹中将shebang行称为/ user / local / bin / python3.
我的python安装路径
Python 3.4.3 (default,Oct 14 2015,20:28:29)
[GCC 4.8.4] on linux
Type "help","copyright","credits" or "license" for more information.
>>> import sys
>>> sys.path
['','/home/myuser/project','/usr/lib/python3.4','/usr/lib/python3.4/plat-x86_64-linux-gnu','/usr/lib/python3.4/lib-dynload','/usr/local/lib/python3.4/dist-packages','/usr/lib/python3/dist-packages']
>>>
所以有没有办法没有改变shebang线我可以重定向或链接到我的python3安装,以摆脱这个错误.
是否建议在给定路径中安装python3. ?
请指教.
如果您无权访问Dockerfile.然后,您可以从正在运行的docker实例中运行上述命令.这应该解决您的问题,而无需修改文件.
https://docs.docker.com/engine/reference/builder/#cmd
Azure 函数 Python - 使用 file.open 时没有这样的文件或目录
以下两条路径在我这边的单例模式下运行良好:
1,
import logging
from pathlib import Path
import azure.functions as func
def main(req: func.HttpRequest) -> func.HttpResponse:
path = str(Path.home()) + "/test.txt"
fileData = open(path,'w+').write("testsomething")
return func.HttpResponse(
"create file with no problem."+path,status_code=200
)
2,
import logging
import tempfile
import azure.functions as func
def main(req: func.HttpRequest) -> func.HttpResponse:
path = tempfile.gettempdir() + "/test.txt"
fileData = open(path,status_code=200
)
这篇文章说,Files written to the temporary directory aren't guaranteed to persist across invocations(也许你的问题类似,但不确定)。
您的代码似乎与多实例无关,但无论如何,这不是推荐的方法。正如 user3732793 在他的回答中所说,您可以直接将数据发送到存储 blob 而无需临时文件。只需使用 HTTP GET 请求检索 .xlsx 文件,然后通过 blob output binding 或 blob storage sdk 将数据发送到 blob 存储。
,我使用了临时文件来解决这个问题。
fp = tempfile.NamedTemporaryFile()
fp.write(r.content)
然后,当上传到 blob 存储时,我不得不打开文件并读取字节。
with open(fp.name,'rb') as data:
logging.info(data)
if azureConnector.exists():
logging.info('connector exists')
return
azureConnector.upload_blob(data,overwrite=True)
现在正在将文件上传到 Azure blob 存储。
今天的关于pip安装/usr/local/opt/python/bin/python2.7:错误的解释器:没有这样的文件或目录的分享已经结束,谢谢您的关注,如果想了解更多关于/ usr / bin / env:python2:没有这样的文件或目录、/usr/bin/python^M: 解释器错误: 没有那个文件或目录、/usr/local/bin/python3:bad interpreter:ubuntu 14.04没有这样的文件或目录、Azure 函数 Python - 使用 file.open 时没有这样的文件或目录的相关知识,请在本站进行查询。
本文标签: