When i attempt to import selenium i get the error:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import selenium
ModuleNotFoundError: No module named 'selenium'
My selenium module is currently in:
C:\Users\Maseeek\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\selenium
I've seen other people have it in a different directory and want to know how to fix it.
If you are using "PYCHARM" and if you created project with "Virtual Environment" you should choose "Python 3.x.x" instead of "Virtual Environment Python 3.9" that PyCharm created.
If you installed "anaconda" before you need to change paths of libaries.
If you're using PyCharm, then this might help:
PyCharm sometimes shows an error in importing modules that have already been installed (that's annoying). But, try to change the file location to this destination:
C:\Users\Maseeek\PyCharm Projects\(project name)\venv\site-packages\
or try installing the package in PyCharm using python with the following code:
from sys import *
from subprocess import *
call(["-m", "pip", "install", "selenium"])
Related
I installed python 3.8.8 and installed wxpython using pip at terminal
pip install wxpython
and i run simple program
import wx
print(wx.version())
in pycharm and pycharm`s python console, I got
ModuleNotFoundError: No module named 'wx'
in IDLE, I got
Traceback (most recent call last):
File "C:/Users/tasoo/OneDrive/Desktop/wx.py", line 1, in <module>
import wx
File "C:/Users/tasoo/OneDrive/Desktop\wx.py", line 2, in <module>
print(wx.version())
AttributeError: partially initialized module 'wx' has no attribute 'version' (most likely due to a circular import)
in python.exe code works
I want to import wx in pycharm project.
I tried add python in system path but it didn`t work.
You have problem because you saved code in file wx.py and now import wx loads your file wx.py instead of module wx. Rename your file - ie. main.py instead of wx.py
PyCharm may have own Python installed and it may need to install wx in this Python.
Check
import sys
print(sys.executable)
to get full path to Python used by PyCharm and then use this path
/full/path/to/python -m pip install wx
Or search in PyCharm settings (in menu File) and change Python Interpreter.
In PyCharm for every project you may set different Python - if you have installed many versions.
Im trying to import a module called geoip2 from pypi into python it is not included in its standard libraries.
I open command prompt and type:
pip install geoip2
The command prompt returns
Successfully installed geoip2-2.4.2
After it is installed I try importing it using IDLE:
import geoip2.webservice
which returns the error:
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
import geoip2.webservice
ImportError: No module named 'geoip2'
Although it is installed already I cannot use it. How can i prevent this? Take note that I use python 3.6
May be you have two different version of Python installed. Try opening IDLE using the Python version where you have installed geoip.
Instead of:
import geoip2.webservice
Try doing:
import geoip2
from geoip2 import webservice
Since geoip2.webservice is not installed, geopip2 is and .webservice is an function object of that module.
Further, you can avoid typing geoip2.webservice every time by doing:
import geoip2
from geoip2 import webservice as gws
Then anytime you want to run the .webservice function, you can just use gws.
Alternatively:
Just do:
import geoip2
Then in your script you can call it:
geoip2.webservice(#do stuff here or however you call the function)
I am trying to configure svn hook for email notification using mailer.py script from apache, but it always crash on import of svn libs. I try two ways of installing svn and python. I try to install everything manually using command line and use CollableNet installer that have preinstalled Python and all libs I need but result is the same.
Now I try to import one library from hole package that I need using python in command line and I have such response:
>>> import svn.core
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named svn.core
I try to fix it using:
1) import sys; sys.path.append("C:\csvn\lib\svn-python\svn")
and
2) C:\csvn\lib\svn-python\svn>python "\__init__.py" install
But it didn't help.
For now I have no package with setup.py to install it.
I spend a lot of time on this task, and going crazy a little). Please give me any suggestion how to fix it.
When I try to import the slycot module in spyder (version 2.2), I get the following error:
RuntimeError: module compiled against API version 7 but this version of numpy is 6
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Applications/Spyder.app/Contents/Resources/lib/python2.7/slycot/__init__.py",
line 4, in <module>
from slycot.analysis import ab01nd,ab05md,ab05nd,ab07nd,ab08nd, ab09ad
File "/Applications/Spyder.app/Contents/Resources/lib/python2.7/slycot/analysis.py",
line 21, in <module>
from slycot import _wrapper
ImportError: numpy.core.multiarray failed to import
Now, when I import slycot in the python shell through my terminal, there are no problems at all. I think the reason why there are no problems through the terminal, is that I recently installed numpy 1.7.1. Spyder on the other hand still uses numpy 1.6.2.,hence the error.
I tried to change the numpy version in spyder, but so far that didn't work.
When I change the numpy(6) folder in my spyder lib with the recently installed numpy(7), I get the following error (in spyder):
ImportError: Error importing numpy: you should not try to import numpy from
its source directory; please exit the numpy source tree, and relaunch
your python intepreter from there.
What is the best way to solve this error?
Thanks in advance.
(Spyder dev here) At the moment it's not possible for the user to install anything inside the app. I guess you moved your slycot module from another interpreter to our App (because of the numpy error you mention).
The right way to use different modules not present in the app, is to change the path of your interpreter in:
Tools > Preferences > Console > Advanced settings > Python executable
If you installed slycot using your system Python, you have to select
/usr/bin/python
I am trying to import pythoncom, but it gives me this error: Traceback (most recent call last):
File "F:/Documents and Settings/Emery/Desktop/Python 27/Try", line 2, in
import pythoncom
File "F:\Python27\lib\site-packages\pythoncom.py", line 2, in
import pywintypes
ImportError: No module named pywintypes
I reinstalled Python win32, but it still doesn't fix it. Any help? Also, I am trying to access the pythoncom.PumpMessages() method, an alternative would be nice as well.
If you are using an IDE like I am (PyCharm), you should go the where the Python is installed e.g C:\Users\***\AppData\Local\Programs\Python\Python37\Lib\site-packages
In this folder check for the folder name pywin32. Copy that folder and paste it to C:\Users\***\PycharmProjects\project\venv\Lib\site-packages. After that restart your IDE, then it will import the pywin32 as it did in my case. I hope it helps.
pip install --upgrade pywin32==228