我在 ubuntu 18.04 发行版中使用 WSL,在我点击的 bash 中,sudo -u postgres psql
我收到以下错误:
psql: could not connect to server: No such file or directory
Is the server running locally and accepting connections on
Unix domain socket "/var/run/postgresql/.s.PGSQL.5433"?
Run Code Online (Sandbox Code Playgroud)
然后我尝试了其他 postgres 操作,例如:sudo -u createdb mydb
只得到相同的错误。
请指教。
我尝试使用virtualenvI type创建一个 python 虚拟环境virtuelenv env --python=python3
,但出现错误
PermissionError: [Errno 1] Operation not permitted: '/mnt/d/venv/bin/python3'
所以我使用了命令sudo,因此输入sudo virtualenv env --python=python3
这次命令有效,现在我激活环境并尝试使用 pip 安装一些东西,我得到
Could not install packages due to an EnvironmentError: [Errno 1] Operation not permitted
我知道一个事实,如果pip与 sudo 一起使用,它将安装全局站点包的包,而不是虚拟环境的站点包。我想将东西安装到虚拟环境中。
我在 WSL 上运行 ubuntu bionic,我曾经运行 ubuntu xenial 并且没有遇到这个问题。
请指教。
python sudo virtualenv windows-subsystem-for-linux ubuntu-18.04
我无法理解inputs调用中关键字的用法.backward()。
该文档说明如下:
\n\n\n输入(张量序列) \xe2\x80\x93 输入,梯度将累积到 .grad 中。所有其他张量将被忽略。如果未提供,则梯度将累积到用于计算 attr::tensor 的所有叶张量中。
\n
据我了解,这允许我们指定我们将查看梯度的输入。
\n已经指定的 if 不是.backward()被称为像损失这样的张量吗loss.backward()?\n计算图不能确保梯度是根据相关参数计算的。
我还没有找到更好地解释这一点的来源。如果我能得到解释,我将不胜感激。
\n我想重写基于类的视图的创建方法,它实现了ListCreateAPIView,一般不会同时覆盖类的方法get_queryset(self)方法的要求,该URL**kwargs是从访问self,但我想重写.create()的方法CreateModelMixin,所以我在拍了一下查找签名的代码作为create(self, request, *args, **kwargs)django 在**kwargs, *args这个函数中传递了什么?这些网址**kwargs是偶然的吗?我如何覆盖通用视图中的 create 方法,因为通用视图request的任何函数都是从 访问的,self但是创建函数的签名显式需要一个请求参数。
python ×3
windows-subsystem-for-linux ×2
autograd ×1
django ×1
django-views ×1
linux ×1
postgresql ×1
pytorch ×1
sudo ×1
ubuntu ×1
ubuntu-18.04 ×1
virtualenv ×1
windows ×1