我vim
使用Homebrew在MacOS 10.14.5上新安装了(Vi IMproved 8.1)作为文本编辑器。每次我运行vim时,都会收到以下错误消息:
Warning: Failed to set locale category LC_NUMERIC to en_CH.
Warning: Failed to set locale category LC_TIME to en_CH.
Warning: Failed to set locale category LC_COLLATE to en_CH.
Warning: Failed to set locale category LC_MONETARY to en_CH.
Warning: Failed to set locale category LC_MESSAGES to en_CH.
Run Code Online (Sandbox Code Playgroud)
我必须单击ENTER,它可以工作,但我想摆脱该错误消息。
我在该链接上看到了类似的消息
如何摆脱该错误消息?
我正在尝试Julia 1.3
使用以下硬件的多线程功能:
Model Name: MacBook Pro
Processor Name: Intel Core i7
Processor Speed: 2.8 GHz
Number of Processors: 1
Total Number of Cores: 4
L2 Cache (per Core): 256 KB
L3 Cache: 6 MB
Hyper-Threading Technology: Enabled
Memory: 16 GB
Run Code Online (Sandbox Code Playgroud)
运行以下脚本时:
function F(n)
if n < 2
return n
else
return F(n-1)+F(n-2)
end
end
@time F(43)
Run Code Online (Sandbox Code Playgroud)
它给我以下输出
2.229305 seconds (2.00 k allocations: 103.924 KiB)
433494437
Run Code Online (Sandbox Code Playgroud)
但是,当运行下面的代码从Julia页面复制的关于多线程的代码时
import Base.Threads.@spawn
function fib(n::Int)
if n < 2 …
Run Code Online (Sandbox Code Playgroud) 我有 Julia 1.1
我想更新到最新版本的包,在这种情况下,Flux 8.3.0
根据Flux.jl 的文档
当我打字时
Pkg.status("Flux")
Run Code Online (Sandbox Code Playgroud)
我得到
Status `~/.julia/environments/v1.1/Project.toml`
[587475ba] Flux v0.6.10
Run Code Online (Sandbox Code Playgroud)
我也试过:
Pkg.add("Flux")
Pkg.update("Flux")
Run Code Online (Sandbox Code Playgroud)
但它不会改变版本
编辑 我在 Bogumi 发表评论后尝试了以下命令?神滑雪
Pkg.update()
Run Code Online (Sandbox Code Playgroud)
给我
Updating registry at `~/.julia/registries/General`
? Warning: Some registries failed to update:
? — `~/.julia/registries/General` — registry dirty
? @ Pkg.Types /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.1/Pkg/src/Types.jl:1269
Updating git-repo `https://github.com/MikeInnes/IRTools.jl.git`
Updating git-repo `https://github.com/JuliaInterop/RCall.jl.git`
Updating git-repo `https://github.com/FluxML/Zygote.jl.git`
Updating git-repo `https://github.com/VMLS-book/VMLS.jl`
Resolving package versions...
ERROR: Unsatisfiable requirements detected for package ZygoteRules [700de1a5]:
ZygoteRules [700de1a5] log:
??ZygoteRules [700de1a5] has no known versions! …
Run Code Online (Sandbox Code Playgroud) 有什么简单的方法可以查看函数(例如包quantile
中的函数Statistics.jl
)完成的精确计算。这里的目标只是为了了解该特定函数完成的计算,而不是编辑整个包。
提前谢谢了
我正在尝试使用matplotlib
. 然而,y 轴自下而上递减。我希望它在不翻转图像的情况下自下而上增加
我有以下代码
import matplotlib.pyplot as plt
import numpy as np
img_path = '/path/to/image.tif'
img = plt.imread(img_path)
plt.imshow(img, cmap = 'gray')
Run Code Online (Sandbox Code Playgroud)
图像可以在那里获得
我试过plt.gca().invert_yaxis()
没有成功
我该怎么办
我想计算 A 列的平方,1,2,3,4
用其他计算处理它,将其存储在 C 列中
using CSV, DataFrames
df = DataFrame(A = 1:4, B = ["M", "F", "F", "M"])
df.C = ((((df.A./2).^2).*3.14)./1000)
Run Code Online (Sandbox Code Playgroud)
有没有更简单的写法?
我想知道如何像本视频所述交互式地旋转3D图(如果您从上方或下方或从右或左进行选择)。我可以在spyder或jupyter Notebook中生成3D图,但此后它保持静态,无法与之交互并旋转/更改视点角度。
这是代码:
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
from matplotlib import cm
from matplotlib.ticker import LinearLocator, FormatStrFormatter
import numpy as np
fig = plt.figure()
ax = fig.gca(projection='3d')
scale = 8
# Make data.
X = np.arange(-scale, scale, 0.25)
Y = np.arange(-scale, scale, 0.25)
X, Y = np.meshgrid(X, Y)
Z = X**2 + Y**2
# Plot the surface.
surf = ax.plot_surface(X, Y, Z, cmap=cm.coolwarm,
linewidth=0, antialiased=False)
# Customize the z axis.
ax.set_zlim(0, 100)
ax.zaxis.set_major_locator(LinearLocator(10))
ax.zaxis.set_major_formatter(FormatStrFormatter('%.02f'))
# …
Run Code Online (Sandbox Code Playgroud) 我在 python 脚本中有一个应用程序,my_app.py
想在 MacOS (10.14) 上制作一个独立的可执行文件。按照此处的视频教程,我依次输入了以下命令:
pip install virtualenv
virtualenv venv --system-site-packages
source venv/bin/activate
pip install py2app
cd /path/to/my_app.py
python setup.py py2app -A
Run Code Online (Sandbox Code Playgroud)
使用以下setup.py
文件:
from setuptools import setup
APP = ["my_app.py"]
DATA_FILES = []
OPTIONS = {
"argv_emulation": True,
"packages": ["certifi"],
}
setup(
app = APP,
data_files = DATA_FILES,
options = {"py2app": OPTIONS},
setup_requires = ["py2app"]
)
Run Code Online (Sandbox Code Playgroud)
但收到以下错误消息:
Traceback (most recent call last):
File "setup.py", line 13, in <module>
setup_requires = ["py2app"]
File "/Users/mymac/venv/lib/python3.7/site-packages/setuptools/__init__.py", …
Run Code Online (Sandbox Code Playgroud) 我有麻烦安装vim
用python 3
的MacOS
。我知道在该主题上有一个类似的类似问题。但我无法解决问题
首先我跑vim --version
了
Included patches: 1-503, 505-680, 682-1283
Compiled by root@apple.com
Normal version without GUI. Features included (+) or not (-):
+acl +file_in_path -mouse_sgr +tag_old_static
-arabic +find_in_path -mouse_sysmouse -tag_any_white
+autocmd +float -mouse_urxvt -tcl
-balloon_eval +folding +mouse_xterm -termguicolors
-browse -footer +multi_byte -terminal
+builtin_terms +fork() +multi_lang +terminfo
+byte_offset -gettext -mzscheme +termresponse
+channel -hangul_input +netbeans_intg +textobjects
+cindent +iconv +num64 +timers
-clientserver +insert_expand +packages +title
-clipboard +job +path_extra -toolbar
+cmdline_compl +jumplist -perl +user_commands …
Run Code Online (Sandbox Code Playgroud) 我有一个时间序列,包含 500 个大小的样本和 2 种类型的标签,并且想要使用 pytorch 构建一个 1D CNN:
class Simple1DCNN(torch.nn.Module):
def __init__(self):
super(Simple1DCNN, self).__init__()
self.layer1 = torch.nn.Conv1d(in_channels=50,
out_channels=20,
kernel_size=5,
stride=2)
self.act1 = torch.nn.ReLU()
self.layer2 = torch.nn.Conv1d(in_channels=20,
out_channels=10,
kernel_size=1)
self.fc1 = nn.Linear(10* 1 * 1, 2)
def forward(self, x):
x = x.view(1, 50,-1)
x = self.layer1(x)
x = self.act1(x)
x = self.layer2(x)
x = self.fc1(x)
return x
model = Simple1DCNN()
model(torch.tensor(np.random.uniform(-10, 10, 500)).float())
Run Code Online (Sandbox Code Playgroud)
但收到此错误消息:
Traceback (most recent call last):
File "so_pytorch.py", line 28, in <module>
model(torch.tensor(np.random.uniform(-10, 10, 500)).float())
File "/Users/lib/python3.8/site-packages/torch/nn/modules/module.py", …
Run Code Online (Sandbox Code Playgroud) python ×5
julia ×4
macos ×2
matplotlib ×2
python-3.x ×2
vim ×2
3d ×1
axis ×1
calculation ×1
dataframe ×1
executable ×1
fibonacci ×1
flux.jl ×1
function ×1
interactive ×1
local ×1
locale ×1
package ×1
py2app ×1
pytorch ×1
terminal ×1
torch ×1
virtualenv ×1