小编use*_*619的帖子

使用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
查看次数

在 Python 中为换行符添加缺失的句点

我想用 Python 编写一个正则表达式来执行以下操作

转换所有以“.”结尾的句子[alphanumeric]\n并将其替换为“。”

例如

I went there
I also went there.
It is


That-
I too went there!
It went there?
It is 3
Run Code Online (Sandbox Code Playgroud)

所以假设我们有

应转换为

I went there.
I also went there.
It is.


That-
I too went there!
It went there?
It is 3.
Run Code Online (Sandbox Code Playgroud)

我怎样才能做到这一点?

编辑:输入字符串是

s = "I went there\nI also went there.\nIt is\n\nThat-\nI too went there!\nIt went there?\nIt is 3"
Run Code Online (Sandbox Code Playgroud)

还, ”?” 不应附加“.”

EDIT2:我修改了示例,使其包含一个 double\n和一个以 结尾的句子-。因此“-”不应附加“.”。

python regex string

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

将float64 3-D数组转换为Julia中的float32 3-D数组

我尝试了以下,但没有一个工作

A = zeros(2,2,2)
A[:,:,1] = [1 2; 3 4]
A[:,:,2] = [10 20; 30 40]

for i=1:size(A,1)
    convert(Array{Float32,2}, A[i,:,:])
end

print(typeof(A))
Run Code Online (Sandbox Code Playgroud)

输出: Array{Float64,3}

convert(Array{Float32,3}, A)
print(typeof(A))
Run Code Online (Sandbox Code Playgroud)

输出: Array{Float64,3}

map(y->(Float32,y), A)
print(typeof(A))
Run Code Online (Sandbox Code Playgroud)

输出: Array{Float64,3}

我甚至无法将Float64数组转换为以下数组Int:

for i=1:size(A,1)
    round.(Int,  A[i,:,:])
end

print(typeof(A))
Run Code Online (Sandbox Code Playgroud)

输出: Array{Float64,3}

还有什么我可以尝试将其转换Array{Float64,3}Array{Float32,3}

arrays julia

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

Why weird characters shown in cout for string variable in C++?

I have the following code:

Card.h:

#include <string>

using namespace std;

class Card
{
public:
    Card(string name);
    ~Card() {}; 

    string GetName();

private:
    string Name;

};
Run Code Online (Sandbox Code Playgroud)

Card.cpp:

#include "Card.h"

using namespace std;

Card::Card(string name) {Name=name;};
string Card::GetName() {return Name;}
Run Code Online (Sandbox Code Playgroud)

Deck.h:

#include "Card.h"
#include <vector>

class Deck {
    public:
        Card& DrawCard();
        void AddCardToDeck(Card& c);

        Deck();
        ~Deck();

    private:
        std::vector <Card> cardsindeck;
};
Run Code Online (Sandbox Code Playgroud)

Deck.cpp:

#include "Deck.h"
#include <vector>
#include <iostream>

using namespace std;

Card& Deck::DrawCard() {
    //cout << cardsindeck.back().GetName()<<" was …
Run Code Online (Sandbox Code Playgroud)

c++ string

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

标签 统计

string ×2

arrays ×1

c++ ×1

heroku ×1

julia ×1

python ×1

python-3.x ×1

regex ×1