Even after installing selenium using pip on Python 3.6.3, whenever I try to run a code with import selenium I get the message that ModuleNotFoundError: No module named 'selenium'.
I usually use Anaconda Prompt and run my codes in Jupyter notebook, but I made the installation also in regular cmd.
Does anyone have an idea about how to solve this?
From your command prompt you can run:
$ conda list
This will list all of the packages in your environment.
Ensure that your system is running the anaconda flavor of python.
Python 3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 12:04:33)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import selenium
To ensure the uniformity of package management you could use:
$ conda install -c conda-forge selenium
Edit: As you can see the path at which the "Requirement is already satisfied" is not the path in which Anaconda is installed.
You may or may not get a message saying that selenium is already installed. In that case, you may just need to ensure that you are in the conda environmnet—either a virtual conda environment or running right off the anaconda installation.
If you use the Anaconda GUI and you can install packages through this, I would try to do so. The point of virtual environments is to void these issues. I would bet importing selenium at the command prompt works, however, trying to use it within a Jupyter Notebook fails—because it is outside the environment, virtual or otherwise.
Updated:
Installation and testing of installation:
windows
macos
linux - the linux people know what's up.
I think you have both python 2.x and python 3.x installed on your system.
When you do pip install selenium, the module gets installed for python 2.x.
To install the module for python 3.x, use pip3 install selenium.
Related
I want to install python from python.org and have it work with wxPython in a terminal on macOS:
Install python 3.9.13 using the macOS 64-bit universal2 installer
Install wxPython using pip - pip3 install -U wxPython
Start python in a shell and try and fire up a wx app:
DB0837:~ andypiper$ /Library/Frameworks/Python.framework/Versions/3.9/bin/python3
Python 3.9.13 (v3.9.13:6de2ca5339, May 17 2022, 11:37:23)
[Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
>>> wx.App()
This program needs access to the screen. Please run with a
Framework build of python, and only when you are logged in
on the main display of your Mac.
Please don't point me at brew or pyenv or anaconda or framework builds - I want the above combination to work, and it seems not to. The download from python.org is a framework build and if I run this from IDLE it works fine using the exact same version of python, so it feels like it must be some macOS security issue or shell/python interaction
I had this problem on an existing codebase after upgrading to Monterey.
My app still worked when built with py2app, but not when running from the command line.
It seems like the underlying wxWidgets method IsDisplayAvailable started to fail, so I just removed the check.
It's in your site packages at wx/core.py, line 2183.
Change
if not self.IsDisplayAvailable():
to
if False:
and you are off to the races.
What can I say? It's very dirty, but I'm working again.
pip was selected while installing ,but when i checked scripts folder ,the folder was empty
since scripts are missing i cannot use pip cammand on terminal,new to programming please help me!!!
i tried installing pip this particular error showes up!!
FOR WINDOWS ONLY
open cmd.
then type pip help, if pip is installed then a message would come explaining how to
use it else an error message stating that the program is not found.
then type python and see whether that's installed properly , if you receive this
Python is not recognized as an internal or external command, operable program or batch file then this means that python is not installed on your system and you need to
reinstall it. Or if it is installed properly then you would get something like this
Python 3.9.5 (tags/v3.9.5:0a7dcbd, May 3 2021, 17:27:52) [MSC v.1928 64 bit
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
to install pip download this pip install and then open your cmd in that folder
where you have installed it by using the cd command(like if you have installed it in downloads you should type in the cmd cd Downloads), then type this python get-pip.py.
And this should have installed pip on your system . (see step 1 to see if it works)
Then just upgrade pip and you are good to go , you can upgrade pip by python -m pip install --upgrade pip
Then try installing a module like pip install tksplash in the cmd.
FOR LINUX ONLY
open your terminal and type sudo apt install python3-pip(works only on debian based disrtos like -: Ubuntu ,Kali , Parrot))
you have not install any pip packages.
you can install new one, then refresh dir.
pip install Flask
Installing Anaconda will be better option. It has all packages required.
get-pip.py needs to be downloaded and run python get-pip.py.
Use Python 3.10, it installs pip properly out of the box.
According to python.org, 3.8.2 is currently the latest version of
Python.
When I try to upgrade python3 using Homebrew (freshly
upgraded), it tells me version 3.7.6_1 is already installed.
When I ask python3 for it's current version, it tells me 3.7.3.
See terminal runs:
Nannas-Computer:some_folder username$ brew update
Already up-to-date.
Nannas-Computer:some_folder username$ brew upgrade
Nannas-Computer:some_folder username$ brew upgrade python3
Warning: python3 3.7.6_1 already installed
Nannas-Computer:some_folder username$ python3 --version
Python 3.7.3
Why are all these versions different, and how can I install the 3.8.2 version on my mac (macOS Mojave, version 10.14.6)?
You can install Python 3.8.x using command:
brew install python#3.8
As it's not main Python distribution on Homebrew, by default it's not accessible by simple typing python3. Binary is located in /usr/local/Cellar/python#3.8/3.8.2/bin/python3.8 and you can create a symlink to it or use directly by typing full path.
It's not that cumbersome as one may think because usually the only thing you need to do is to create a virtual environment and activate it. Since then it'll be your default Python (for this virtualenv):
$ /usr/local/Cellar/python#3.8/3.8.1/bin/python3.8 -m venv my_venv
$ source my_venv/bin/activate
(my_venv)$ python
Python 3.8.1 (default, Dec 27 2019, 18:06:00)
[Clang 11.0.0 (clang-1100.0.33.16)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
After some research I found out the following reasons:
It is possible to upgrade to Python 3.8.2 via Homebrew, but it isn't listed as supplying python due to some complications. See status here. Until this issue is done, 3.7.6_1 is the newest version you can upgrade to (as Homebrew kept telling me).
When I ran python3 --version in terminal, it returned Python 3.7.3 because I had installed this version myself at some point from the official website, without using Homebrew. Upgrading python to 3.7.6 via Homebrew had no effect on this dominating installation of python. I got rid of the manually installed version using this useful answer, after which I reinstalled python properly using Homebrew just to be on the safe side and now I finally have:
Nannas-Computer:some_folder username $ python3 --version
Python 3.7.6
I'm using anaconda on linux and I want to install smtplib to send mail.
I have tried,
conda install smtplib which returned:
PackageNotFoundError: Package missing in current linux-64 channels:
- smtplib ,
and,
pip install smtplib which returned:
Could not find a version that satisfies the requirement smtplib (from versions: )
No matching distribution found for smtplib
I found that smtplib comes by default in the standard python distribution and I wonder why it is not available in anaconda.
Question: How to install smtplib? Or more generically, how to install a package that is not included in anaconda?
There are similar questions here and here but without any answers.
Spec: Python 2.7.13 |Anaconda 4.3.1 (64-bit)| (default, Dec 20 2016, 23:09:15)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
First, the real environment manager is conda, and anaconda is actually a collection of generally used packages for scientific calculation, so it is not necessary for creating an environment.
Second, smtplib is a built-in package for both python2.7 and python3.x, so there is no need for installation. You can import it without installing any other package.
Finally, what source activate <venv name> really does is that modify your environment variables in the current console. That also means change the path of command python and pip and the path where the python program looks for installed modules. In a word, source activate <venv name> activate a separated environment for python.
https://docs.python.org/3/library/smtplib.html
It's a part of the standard library, you should be able to import the smtplib module without installing anything. Anaconda comes with Python so smtplib technically does come with Anaconda if that makes sense.
Install smtplib in your system using command prompt and then you can use same via Anaconda
To know about how to install smtplib in windows visit https://stackoverflow.com/a/70484083/17385292
I need to use python for a machine learning course and I also need to install some external libraries. I'm a bit confused as to what the correct order is for installation of everything as I've heard the paths can get messed up if done incorrectly.
Here is what I need:
Python version 2.7
IPython
The libraries available inside this package by enthought
So 1st step is to see whether I have python installed
Yes: I have this version
AM#~ >python
Python 2.7.2 (default, Jun 20 2012, 16:23:33)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Next IPython
How do I check if I have IPython?
Also whats the ideal procedure to install it? Any caveats? Any special path settings?
Can I use brew to install it?
Enthought libraries
Do I have to install these libraries in any particular order? before IPython? after IPython?
Do I have to set any specific paths?
Im trying to avoid having to install and make an error and then reinstall etc.
So any help would be much appreciated. Im running Mac OS X 10.7 (Mountain Lion).
Thanks
You can simply check the version, as we do with other software packages to check if a software package is installed properly or not.
Type in your terminal.
ipython --version
It'll print the version if ipython is installed properly.
It is so simple to get all IPython, Matplotlib, Scipy etc. now that you have Python 2.7 installed. If this is for a course, I assume you have a .edu email address with this institution? If so just go here: http://www.enthought.com/products/edudownload.php
Submit your info. Download and install it like any other program. You will then be able to call ipython from the terminal. Or to use matplotlib call ipython --pylab from the terminal.
Definitely do not go about installing the libraries one-by-one unless you are very familiar with how that works.