我正在尝试在Anaconda中安装pytorch以在Windows中使用Python 3.5.按照pytorch.org中的说明,我在Anaconda中介绍了以下代码:
pip3 install torch torchvision
Run Code Online (Sandbox Code Playgroud)
但是出现了以下错误:
Command "python setup.py egg_info" failed with error code 1 in C:\Users\sluis\AppData\Local\Temp\pip-install-qmrvz7b9\torch\
Run Code Online (Sandbox Code Playgroud)
通过在网上搜索我发现它可能是因为setuptools过时但我检查并更新.我也尝试过:
conda install -c peterjc123 pytorch cuda80
Run Code Online (Sandbox Code Playgroud)
但出现以下错误:
The following specifications were found to be in conflict:
- pytorch
Use "conda info <package>" to see the dependencies for each package.
Run Code Online (Sandbox Code Playgroud)
我还尝试加载我在以下网站下载的pytorch的tar.bz2文件:
anaconda.org/peterjc123/pytorch/files
然后就是:
$ conda install filename.tar.bz2
Run Code Online (Sandbox Code Playgroud)
但是我收到以下错误:
Error: HTTPError: 404 Client Error: None for url: file:///C|/Users/sluis/pytorch-0.3.1-py36_cuda80_cudnn6he774522_2.tar.bz2: file:///C|/Users/sluis/pytorch-0.3.1-py36_cuda80_cudnn6he774522_2.tar.bz2
Run Code Online (Sandbox Code Playgroud)
我对这个编程世界很陌生,所以我真的不知道如何更多地了解错误.谁知道如何安装pytorch?
编辑:正如我在尝试的评论中所建议的:
conda install pytorch torchivsion -c pytorch
Run Code Online (Sandbox Code Playgroud)
我收到以下错误: …
我有以下数据框称为 language
lang level
0 english intermediate
1 spanish intermediate
2 spanish basic
3 english basic
4 english advanced
5 spanish intermediate
6 spanish basic
7 spanish advanced
Run Code Online (Sandbox Code Playgroud)
我通过使用将每个变量分类为数字
language.lang.astype('category').cat.codes
和
language.level.astype('category').cat.codes
分别.获取以下数据框:
lang level
0 0 1
1 1 1
2 1 0
3 0 0
4 0 2
5 1 1
6 1 0
7 1 2
Run Code Online (Sandbox Code Playgroud)
现在,我想知道是否有办法获得哪个原始值对应于每个值.我想知道列中的0值lang对应于英语等等.
是否有任何功能可以让我收回这些信息?
假设我有以下列表:
list1 = [{'a': 1}, {'b': 2}, {'c': 3}]
我想将其转换为具有两列的熊猫数据框:一列用于键,一列用于值。
keys values
0 'a' 1
1 'b' 2
2 'c' 3
Run Code Online (Sandbox Code Playgroud)
为此,我尝试使用pd.DataFrame(list1)and pd.DataFrame.from_records(list1),但是,在这两种情况下,我都得到了一个数据框,如:
a b c
0 1.0 NaN NaN
1 NaN 2.0 NaN
2 NaN NaN 3.0
Run Code Online (Sandbox Code Playgroud)
有什么方法可以指定我想要什么?通过研究,我只能找到我上面描述的方式。
I am trying to download an Azure Blob Storage file from my storage account, to do so, I have checked what the URL is and I am doing the following:
with urllib.request.urlopen("<url_file>") as resp:
img = np.asarray(bytearray(resp.read()), dtype="uint8")
Run Code Online (Sandbox Code Playgroud)
But I am getting the following error:
urllib.error.HTTPError: HTTP Error 404: The specified resource does not exist.
Run Code Online (Sandbox Code Playgroud)
I have doubled checked that the url is correct. Could this have something to do with not having passed the keys of my subscription or …
我们假设我有以下列表列表
list1 = [['a','b'],['a'],['b','c'],['c','d'],['b'], ['a','d']]
Run Code Online (Sandbox Code Playgroud)
我想知道是否有一种方法来转换list1字典中的所有新字典将使用相同的键的每个元素.例如:如果['a']
成为{'a':1},并且['b']成为{'b':2},我希望所有键a的值1和所有键b的值的值2.因此,在创建字典时['a','b'],我想变成{'a':1, 'b':2}.
到目前为止我发现的是从列表列表中创建字典的方法,但是使用第一个元素作为键,列表的其余部分作为值:
请注意,这不是我感兴趣的.我想要获得的结果list1是:
dict_list1 = [{'a':1,'b':2}, {'a':1}, {'b':2,'c':3}, {'c':3,'d':4}, {'b':2}, {'a':1,'d':4}]
Run Code Online (Sandbox Code Playgroud)
我对那些数字的项目并不感兴趣,但是对于每个不同的键,数字是相同的.