Ubuntu System Python3 related environment or module installation

Source: Internet
Author: User
Tags unpack

Prerequisite: sudo is required before the general user installs the command, or under the root user

1. Ubuntu 16.04 Installation Pycharm
    • Ubuntu 16.04 Installation Pycharm

This article installs the Pycharm through the third party source, the benefit is the upgrade convenience.

Add Source:
$ sudo add-apt-repository ppa:mystic-mirage/pycharm

Installation fee for Professional Edition:
$ sudo apt-get update
$ sudo apt-get install Pycharm

Install the free Community Edition:
$ sudo apt-get update
$ sudo apt-get install pycharm-community
$ sudo apt remove pycharm pycharm-community && sudo apt autoremove

Without configuring environment variables, you can start pycharm-community at any time at the terminal to open the Pycharm IDE

    • Pycharm Switching Python2 and Python3

Select Pycharm view--tick toolbar, click the Wrench icon in the toolbar--project interpreter toggle

2, ubuntu16.04 install git:

Apt-get Install git

Git init

Initializing an empty Git repository at/home/linuxidc/python3_1000/.git/

git clone https://github.com/Ranxf/1000 (clone a project or script already on git to local)

3, Ubuntu16.04 installation pip:

Apt-get Install Python3-pip

4, Ubuntu16.04 installation pytest:

PIP3 Install Pytest

Pytest--version (version view), results This is pytest version 3.2.3, imported from/usr/local/lib/python3.5/dist-packages/pytest.py

5, Ubuntu16.04 installation Selenium (after the installed directory/usr/local/lib/python3.5/dist-packages/)

[Email protected]:/usr/bin# pip3 Install selenium or python3-m pip install selenium automatically installs the latest version senlenium-3.6.0

If you have previously installed SELENIUM2, perform an upgrade installation

Pip Install--upgrade Selenium

To view the Selenium version method:

Under Python console:

>>>import Selenium
>>>print (selenium.__version__)
3.6.0

Webdrive supports Firefox (geckodriver), Chrome (chromedrive), IE (driver), and Opera (driver). Each browser driver http://www.seleniumhq.org/projects/webdriver/

6, Ubuntu16.04 manual installation of any version of Firefox

After the installation of this system, the Firefox version is 51.0.1 (64-bit).

If you want to manually download the latest version of Firefox in Ubuntu, go to its download page. With it you will be able to get to the latest version and install it.

If you want to install other versions of Firefox from the initial version, visit this page. In this you will see each version starting from 0.8.

After downloading the version you want, switch to the download folder in the home directory, as most of the Ubuntu files are downloaded here.

Configure Firefox

Since most Firefox download files are saved in. tar and. bz2 formats, you must extract the files from these compressed packages. There are many ways to extract files in Ubuntu.

For example, I use the command below. It is easy to extract files from. tar and. bz2.

      1. Tar -xvf Firefox*. Tar. bz2

After unpacking, a new Firefox file will appear in the download folder. This includes all of the Firefox files and executable files.

Since we do not want to delete the currently installed Firefox, we must create a separate folder for each version of Firefox. Therefore, for Firefox version 30, use the following command to create a folder in the/opt directory that contains the new Firefox content.

      1. sudo mv Firefox//opt/firefox55

Now, all the files contained in the/opt/firefox55/ directory are version 30.

Create a new Firefox executable symbolic link

By default, Firefox's executable file is under this path:/user/bin/firefox. What we want to do is create a backup temporarily so that we can use our custom installed executable file.

To do this, run the following command.

      1. sudo mv /usr/bin/firefox /usr/bin/Firefox - old

Now that we have moved the Firefox executable from its default location, we must link the default location to our new custom installation file. To do this, run the following command to create a symbolic link for our version 55.

      1. sudo ln -s /opt/firefox55/firefox /usr/bin /Firefox

This setting is complete, and our custom-installed Firefox is the default for Ubuntu. Every time you start Firefox, it will load a new executable file with the new link.

7, Ubuntu16.04 manual InstallationGeckodriver.

Download Geckodriver Address https://github.com/mozilla/geckodriver/releases/

    • Download the file to the home/download directory;
    • cd download, TAR-XVF geckodriver-v0.19.1-linux64.tar.gz;
    • CP geckodriver/usr/bin/
    • chmod +x geckodriver

This use of the Firefox version 55, supporting geckodriver for v0.19.1.

8, Ubuntu16.04 install Chrome method:
  • wget-c https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb  
     \--2017-11-03 11:22:42--Https://dl.google.com/linux/direct/google-chrome-stable_current_ Amd64.deb parsing host dl.google.com (dl.google.com) ... 203.208.43.70, 203.208.43.78, 203.208.43.64, ... Connecting dl.google.com (dl.google.com) |203.208.43.70|:443 ... is connected. An HTTP request has been made and is waiting for a response ... $ OK Length: 48725174 (46M) [application/x-debian-package] saving to: "Google-chrome-stable_current_amd64.deb" Google-chrome-stabl 100%[===================>] 46.47M 3.88mb/s in 11s 2017-11-03 11:22:54 (4.04 MB/s)-Saved "G Oogle-chrome-stable_current_amd64.deb "[48725174/48725174])  
     
  • Dpkg-i Google-chrome-stable_current_amd64.deb
    [Email protected]:/opt# sudo dpkg-i google-chrome-stable_current_amd64.debsudo: Unable to resolve host: LINUXIDC: Connection timed out (reading database ... The system currently has a total of 222,840 files and directories installed. ) is preparing to unpack Google-chrome-stable_current_amd64.deb  

    You can launch chrome from the app and lock to the launchpad.

If the installation process has the following error:

If you see similar text as shown below

selecting previously unselected package google-chrome-stable. (Reading database ... 154656 files and directories currently installed.) Preparing to unpack Google-chrome-stable_current_amd64.deb ... Unpacking google-chrome-stable (50.0.2661.86-1) ... dpkg:dependency problems prevent configuration of Google-chrome-stable:google-chrome-stable depends on Libappindicator1; However:package Libappindicator1 is isn't installed.dpkg:error processing package google-chrome-stable (--install): Dependency problems-leaving unconfiguredprocessing triggers for man-db (2.7.5-1) ... Processing triggers for gnome-menus (3.13.3-6UBUNTU3) ... Processing triggers for desktop-file-utils (0.22-1UBUNTU5) ... Processing triggers for mime-support (3.59UBUNTU1) ... Errors were encountered while processing:google-chrome-stable    

The execution

sudo apt-get install

At this point, as shown

‘apt-get -f install‘ to correct these.The following packages have unmet dependencies:google-chrome-stable : Depends: libappindicator1 but it is not installedE: Unmet dependencies. Try using -f.

Then execute.

-f

Once you have finished, retry the following command to successfully install Chrome

sudo dpkg -i google-chrome-stable_current_amd64.deb

9、Ubuntu16.04安装chrome驱动方法

If you want to run the Web automation use case only with IE or chrome, you need to install the appropriate browser driver first. Note that different versions of the browser also correspond to different versions of the driver, http://chromedriver.storage.googleapis.com/index.html select the corresponding version to install.
My browser version is: Version 62.0.3202.75 (official version) (64-bit), I downloaded the driver for V2.33.
----------chromedriver v2.33 (2017-10-03)----------Supports Chrome v60-62resolved issue 2032:chromedriver crashes While creating DNS resolver [[' Pri-1 ']]resolved issue 1918:get/setwindowsize & get/setwindowposition Commands is FAI  Ling on chromev62+ [[' Pri-1 ']]resolved issue 2013:android 8.0.0 webviews not supported [[' Pri-2 ']]resolved issue 2017:in  Mobileemulation "element is not clickable" if it's outside the visible area [[' Pri-2 ']]resolved issue 1981:chromedriver Does not respect excludeswitches flag [[' Pri-2 ']]partially resolved issue 2002:add cookies are not spec compliant [[]]reso Lved issue 1985:findelement raises the wrong error [[]]

Unzip the file when the download is complete:

[Email protected]:/home/linuxidc/Download # unzip chromedriver_linux64.ziparchive:  Chromedriver_linux64.zip  

And put him under the/urs/bin.

[Email protected]:/home/linuxidc/download # CP chromedriver/usr/bin/

Whether the test was successful

You can write the following code to test:

Ubuntu System Python3 related environment or module installation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.