Ubuntu切换到更新版本的python

时间:2017-03-13 09:08:48

标签: python python-2.7 ubuntu ubuntu-14.04

安装Ubuntu 14.0.4时我有python 2.7.6。我从源代码编译了python 2.7.8:

wget https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tgz
tar -xzvf Python-2.7.8.tgz
cd Python-2.7.8
./configure --enable-shared --enable-static
make
sudo make install

然后当我输入:

 python --version

输出仍然是Python 2.7.6。我想使用python 2.7.8。我错过了什么?

2 个答案:

答案 0 :(得分:0)

尝试使用@RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(Application.class) public class MailClientTest { @Autowired private MailClient mailClient; private GreenMail smtpServer; @Before public void setUp() throws Exception { smtpServer = new GreenMail(new ServerSetup(25, null, "smtp")); smtpServer.start(); } @Test public void shouldSendMail() throws Exception { //given String recipient = "amadeu.cabanilles@gmail.com"; String message = "Test message content"; //when mailClient.prepareAndSend(recipient, message); //then String content = "<span>" + message + "</span>"; assertReceivedMessageContains(content); } private void assertReceivedMessageContains(String expected) throws IOException, MessagingException { MimeMessage[] receivedMessages = smtpServer.getReceivedMessages(); assertEquals(1, receivedMessages.length); String content = (String) receivedMessages[0].getContent(); System.out.println(content); assertTrue(content.contains(expected)); } @After public void tearDown() throws Exception { smtpServer.stop(); } } ,然后sudo apt-get updatesudo apt-get upgrade,它将安装您软件的最新版本。

答案 1 :(得分:0)

您应该从您的版本中删除以前的版本,并将新版本添加到您的环境中。