小编Chr*_*ris的帖子

使用requirements.txt和Heroku时找不到pickle的匹配发行版

我正在使用 Heroku 尝试部署我的应用程序。连接到我的 Github 存储库后,然后在 \xe2\x80\x9cManual deploy\xe2\x80\x9d 下,我点击 \xe2\x80\x9cDeploy Branch\xe2\x80\x9d

\n\n

Github 存储库包含requirements.txt其中包含

\n\n
numpy\npandas\nmatplotlib\npickle\ngunicorn\nflask\n
Run Code Online (Sandbox Code Playgroud)\n\n

Heroku 上的错误说

\n\n
   Collecting pickle (from -r /tmp/build_0f73c7cf93d0cf7e0d53415c51d2e21f/requirements.txt (line 4))\n\n     Could not find a version that satisfies the requirement pickle (from -r /tmp/build_0f73c7cf93d0cf7e0d53415c51d2e21f/requirements.txt (line 4)) (from versions: )\n\n   No matching distribution found for pickle (from -r /tmp/build_0f73c7cf93d0cf7e0d53415c51d2e21f/requirements.txt (line 4))\n\n\n\n!     Push rejected, failed to compile Python app.\n\n !     Push failed\n
Run Code Online (Sandbox Code Playgroud)\n\n

然而,pickle似乎安装在我的 Ubuntu 机器上。当我python在终端上输入时,然后import pickle,我没有看到任何错误

\n\n

另外,当我尝试 …

heroku python-3.x

2
推荐指数
1
解决办法
8799
查看次数

如何在HTML {{post.published_date}}标签处省略时间?

如何在HTML {{ post.published_date }}标签上节省时间?

我使用Python和Django,我尝试显示发布日期,但是我不想显示时间。

<!--html file-->
<a href="{% url 'post_detail' pk=post.pk %}">{{ post.title }} ... &nbsp {{ post.published_date }}</a>
Run Code Online (Sandbox Code Playgroud)

例如

是)我有的:

  • 这是职位标题... 2019年11月19日下午5:37
  • 这也是职务!... 2019年11月24日上午2:30

我想要的是:

  • 这是职位名称。2019年19月19日
  • 这也是职务!...十一月 2019年24月

python django

2
推荐指数
1
解决办法
46
查看次数

PyPI 如何确定包的最新版本是什么?

我最近上传了我在 PyPI 上开发的包的升级版本0.4.3。第二天,我注意到一个我忘记添加的小调整,并上传了新版本0.4.3a0。然而,PyPI 仍然将前一个版本标记为最新版本。我缺少什么?

python package pypi

2
推荐指数
1
解决办法
361
查看次数

EntityManager getRepository,方法find(id)返回控制器

我的问题是,当我尝试使用$em->find方法查找数据库记录时,它返回一个Controller.

让我举一个例子:

Neostat\DiagnosticoBundle\Controller\ComponentController.php:

$em = $this->getDoctrine()->getEntityManager();
$diagnostico = $em->getRepository('NeostatDiagnosticoBundle:Diagnostico')->find($id);
var_dump(get_class($diagnostico));
Run Code Online (Sandbox Code Playgroud)

它回来了Neostat\DiagnosticoBundle\Controller\ComponentController.

但我有一个名为实体Diagnostico.phpsrc/Neostat/DiagnosticoBundle/Entity/Diagnostico.php:

namespace Neostat\DiagnosticoBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Neostat\PacienteBundle\Entity\Paciente;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;

/**
 * Diagnostico
 *
 * @ORM\Table(name="diagnostico")
 * @ORM\Entity(repositoryClass="Neostat\DiagnosticoBundle\Entity\DiagnosticoRepository")
 * @UniqueEntity(fields={"nombre"}, message="Ya existe un diagnostico con ese nombre.")
 */
class Diagnostico
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
private $id;

// etc...
}
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?

php doctrine entitymanager symfony

1
推荐指数
1
解决办法
2万
查看次数

运行Jmeter给出'findstr'不被识别为内部或外部命令

我试图通过批处理文件打开Jmeter,但它给我一个这样的错误:

'findstr' is not recognized as an internal or external command,
operable program or batch file.
Not able to find Java executable or version. Please check your Java installation.
errorlevel=2
Press any key to continue . . .
Run Code Online (Sandbox Code Playgroud)

我怎样才能解决这个问题?

jmeter

1
推荐指数
2
解决办法
7924
查看次数

返回列表中的所有元素

我有一个功能

(defn my-fn [a b & args]
  [a
   (for [arg args]
    (into [] (butlast arg)))
   b])
Run Code Online (Sandbox Code Playgroud)

如果我做 (my-fn [1 2] [3 4] [5 6 2] [7 8 3])

它回来了 [[1 2] ([5 6] [7 8]) [3 4]]

我想要输出,[[1 2] [5 6] [7 8] [3 4]]但我无法弄清楚如何做到这一点

任何帮助将非常感激.

clojure

1
推荐指数
1
解决办法
361
查看次数

设置 Heroku 配置变量时在“&amp;”附近解析错误

我正在通过终端设置我的 Heroku 配置变量,并收到此错误:

zsh:在“&”附近解析错误

我的 zsh 版本是 5.7.1 平台:Mac Mojave

这是我正在运行的命令:

heroku config:set vidly_db=mongodb://vidlyuser:mypassword@vidly-shard-00-00-yyjmw.mongodb.net:27017,vidly-shard-00-01-yyjmw.mongodb.net:27017,vidly-shard-00-02-yyjmw.mongodb.net:27017/test?ssl=true&replicaSet=vidly-shard-0&authSource=admin&retryWrites=true
Run Code Online (Sandbox Code Playgroud)

zsh heroku

1
推荐指数
1
解决办法
3246
查看次数

Heroku 使用 Docker 部署,无法登录?

按照一些教程,我在 Windows 7 上安装了 Heroku CLI(首先是 Git,然后是 Heroku-x64)。Git 在安装过程中有几个选项可供选择,除了编辑器和界面之外,我对大多数选项都保留默认值:我的选择是 mintty。在 mintty 中,我更改了我的 Git 用户名和电子邮件。

安装Heroku-x64后,mintty仍然不支持该heroku命令。Heroku-x64 的文件夹中没有任何可运行的内容,因此我使用系统的文件夹cmd.exe代替,它支持该heroku命令。

现在,按照教程,我运行heroku container:login,几秒钟后它说

! not logged in
Run Code Online (Sandbox Code Playgroud)

它不应该要求我输入 Heroku 用户名和密码吗?

heroku docker

1
推荐指数
2
解决办法
5974
查看次数

请求的运行时 (Python-3.7.3) 不适用于此堆栈 (heroku-18)

我正在使用 Django 2.2.3,但出现此错误:

Requested runtime (Python-3.7.3) is not available for this stack (heroku-18)
Run Code Online (Sandbox Code Playgroud)

但是,Heroku 的 Python 文档说它python-3.7.3应该在堆栈中可用heroku-18

runtime.txt 包含 Python-3.7.3.

完全错误

Counting objects: 100% (43/43), done.
Delta compression using up to 4 threads
Compressing objects: 100% (36/36), done.
Writing objects: 100% (43/43), 10.70 KiB | 996.00 KiB/s, done.
Total 43 (delta 6), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote:  !     Requested …
Run Code Online (Sandbox Code Playgroud)

python django runtime-error heroku

1
推荐指数
1
解决办法
6599
查看次数

在 Windows Python 文件中使用 `touch`

我有一个在 macOS 上运行的 Python 文件,它通过以下方式调用 touch:

os.system("touch -c %s" % apicache_file)

os.system("touch -c %s" % downloadFilename)

os.system("touch -c %s" % meta_cache_file)
Run Code Online (Sandbox Code Playgroud)

但是,我需要在 Windows 机器上运行脚本。如何修改脚本或系统以允许执行此操作?否则,我会收到以下错误:

'touch' is not recognized as an internal or external command, operable program or batch file
Run Code Online (Sandbox Code Playgroud)

python unix windows

1
推荐指数
1
解决办法
364
查看次数