小编Pau*_*sta的帖子

让 Altair 与 Jupyter Notebook 一起工作

试图让 Altair 与 Jupyter Notebook 一起工作,我使用

conda install -c conda-forge altair vega_datasets notebook vega
Run Code Online (Sandbox Code Playgroud)

但是当我尝试做一个示例图时

import altair as alt
from vega_datasets import data

# for the notebook only (not for JupyterLab) run this command once per session
alt.renderers.enable('notebook')

iris = data.iris()

alt.Chart(iris).mark_point().encode(
    x='petalLength',
    y='petalWidth',
    color='species'
)
Run Code Online (Sandbox Code Playgroud)

正如他们的快速入门指南中所见,我明白了

ValueError: 
To use the 'notebook' renderer, you must install the vega package
and the associated Jupyter extension.
See https://altair-viz.github.io/getting_started/installation.html
for more information.
Run Code Online (Sandbox Code Playgroud)

即使我已经使用 Conda 安装了 vega。不过,我可以制作 vega 示例图。我无法启用 Jupyter …

vega jupyter-notebook altair

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

ModuleNotFoundError:在 macos 上使用 pyenv 构建 python 时没有名为“_lzma”的模块

尝试使用 pyenv 在 macOS 上构建 python 版本,但我所做的每次安装都以

? python
>>> import lzma

ModuleNotFoundError: No module named '_lzma'
Run Code Online (Sandbox Code Playgroud)

我已经安装了以下所有软件包:

brew install openssl readline sqlite3 xz zlib
xcode-select --install
Run Code Online (Sandbox Code Playgroud)

唯一需要注意的是 homebrew 将软件包安装到~/.brew.

任何意见都会受到赞赏。

python macos homebrew lzma pyenv

4
推荐指数
5
解决办法
6613
查看次数

等宽字体字符的宽度不固定

我正在尝试对齐一些字符以在 html 中绘制一个框。我选择了等宽字体,以便字符对齐,并为每行绘制了具有相同数量字符的框。

\n

\r\n
\r\n
pre {\n  font-family: \'Roboto Mono\';\n  white-space: pre;\n}
Run Code Online (Sandbox Code Playgroud)\r\n
<link rel="preconnect" href="https://fonts.googleapis.com">\n<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>\n<link href="https://fonts.googleapis.com/css2?family=Roboto+Mono&display=swap" rel="stylesheet">\n<pre>\n    \xe2\x95\xad\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x95\xae\n    \xe2\x94\x82.........................................................................\xe2\x94\x82\n    \xe2\x94\x82-------------------------------------------------------------------------\xe2\x94\x82\n    \xe2\x94\x82                                                                         \xe2\x94\x82\n    \xe2\x95\xb0\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x95\xaf                         \n</pre>
Run Code Online (Sandbox Code Playgroud)\r\n
\r\n
\r\n

\n

不过,当我在浏览器中渲染它时,最右边缘有时可能会错位,具体取决于所使用的等宽字体。

\n

当我使用 Roboto Mono 时:

\n

未对准的盒子机器人单声道

\n

当我使用 Space Mono 时:

\n

未对齐的盒子空间单声道

\n

由于某种原因,我的等宽字符不是等宽的。为什么会发生这种情况?如何强制等宽以对齐字符?

\n

html css monospace google-fonts

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

如何制作bundle.css和bundle.js文件

我一直在创建一个基本网站并一直在前端工作。我使用命令预览它npm start

在我的目录中,有这些文件

app.js
app.scss
index.html
package-lock.json
package.json
webpack.config.js
Run Code Online (Sandbox Code Playgroud)

现在是我将它与我的后端(Flask 和 Python 程序)结合起来的时候了,我想我需要编译所有内容以获取bundle.css 和bundle.js 文件。但是,我似乎找不到编译所有内容并生成这些文件的命令。我认为它们是一些 npm 命令。预先非常感谢!

html javascript css sass node.js

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