我昨天拿到了我的Raspberry Pi,我已经尝试用它编码了。我有一个计划在其上运行的程序,但它只与Python版本3.5.0或3.5.1兼容,我在互联网上找到的所有内容似乎都已过时,与Python 2或者没有相关。与我的问题有关,因为我还没有看到任何其他100%需要Python 3.5并且可以应对3.4(目前已预先安装)。 .exe文件不适用于Linux。我是Raspberry Pi和Linux的新手,因为我一直是Windows用户。任何帮助表示赞赏。非常感谢 - 罗伯特
答案 0 :(得分:18)
cd ~
wget https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tgz
tar -zxvf Python-3.5.1.tgz
cd Python-3.5.1
./configure && make && sudo make install
答案 1 :(得分:7)
我会自己编译(事实上,有几次)。我假设您正在运行Ubuntu或Raspbian。你应该能够install the dependencies:
public void quickSort(ArrayList<String> data, int firstIndex,
int numberToSort) {
if (data.size() < 16) {
insertionSort(data, firstIndex, numberToSort);
} else {
int index = partition(data, firstIndex, numberToSort);
if (firstIndex < index - 1)
quickSort(data, firstIndex, index - 1);
if (numberToSort > index)
quickSort(data, index, numberToSort);
}
}
@Override
public int partition(ArrayList<String> data, int firstIndex,
int numberToPartition) {
String pivot = data.get(firstIndex);
int left = data.indexOf(firstIndex);
int right = data.indexOf(numberToPartition);
while (left <= right) {
while (data.get(left).compareTo(pivot) < 0) // this is where I get the error
left++;
while (data.get(right).compareTo(pivot) > 0)
right--;
if (left <= right) {
temp = data.get(left);
Collections.swap(data, left, right);
data.set(right, temp);
left++;
right--;
}
}
return left;
}
然后转到download the source并解压缩,然后安装它:
$ sudo apt-get install build-essential \
libncursesw5-dev \
libreadline5-dev \
libssl-dev \
libgdbm-dev \
libc6-dev \
libsqlite3-dev tk-dev \
libbz2-dev
如果您错过了依赖关系,它可能会在 $ tar -xzvf https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tgz
$ cd Python-3.5.1
$ ./configure && make && sudo make install
步骤中死亡。但如果一切正常,您将在Raspberry Pi上安装全新的Python 3.5。恭喜!